uiwebview

Embeding youtube video into a UIView/UIWebView

旧巷老猫 提交于 2019-12-11 08:36:20
问题 i am trying to embed YouTube video into a UIView, but i can't figure out why there is this white border on the top left of the video. I also set frameborder = 0. There shouldn't be any white borders. Here is the code for the embed youtube video: I tried it for both UIWebview and UIView... Still the same result... NSString *embedHTML = @"<span style=\"background-color: #fdeee0;\"><iframe width=\"256\" title=\"YouTube video player\" src=\"http://www.youtube.com/embed/KzN6XWDEmXI?HD=1;rel=0

Disable zoom in a UIWebView but keep other user interaction

纵饮孤独 提交于 2019-12-11 08:31:49
问题 I have a UIWebView that shows some text, I want to disable zoom/unzoom but I want to detect when users tap on a link. I have tried with disabling MultiTouch but zoom is still working. 回答1: Setting the minimumZoomScale and maximumZoomScale on your webview's UIScrollView to be 1.0 should prevent the webview from zooming. webview.scrollView.maximumZoomScale = 1.0; webview.scrollView.minimumZoomScale = 1.0; 回答2: Try this - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return

Using a custom URL scheme with UIWebView

社会主义新天地 提交于 2019-12-11 08:23:35
问题 I have a black box container. I love black boxes, they obfuscate things so well. This black box is an encrypted zip (sort of) and has inside some html files (this is the short, not so painful to explain, version). Those files need to be displayed in an UIWebView. Now, the easy way to do it, decrypt, unzip to filesystem, load file from filesystem. That's good, except, the black box contains secret stuff, and can't just lay around on the filesystem, not even a sec, so, I made a C library that

Slow loading UIWebView from string

佐手、 提交于 2019-12-11 08:21:47
问题 I am trying to load a UIWebView from a string as follows: NSString* plainContent = @"..."; NSString* htmlContentString = [[NSString stringWithFormat: @"<html>" "<style type=\"text/css\">" "body { background-color:transparent; font-family:Arial-BoldMT; font-size:18;}" "</style>" "<body>" "<p>%@</p>" "</body></html>", plainContent] retain]; [webView loadHTMLString:htmlContentString baseURL:nil]; Where plain content has some simple HTML with about 5 links and 400 characters. I'm trying to run

Two resizable UIWebViews inside UIScrollView

杀马特。学长 韩版系。学妹 提交于 2019-12-11 08:09:01
问题 I need following view structure, with embedded 2 UIWebViews and 1 UIView (loaded from other xib). But the problem is, because this need to be inside UIScrollView, with same impression like this is single page. (only vertical scrolling need to be enabled). In those UIWebViews, html content is loaded from NSString. Size (height) of UIWebViews and child view is variable. Any advice, how to do that? 回答1: Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If

loadHTMLString Not Working With iOS5?

▼魔方 西西 提交于 2019-12-11 07:54:32
问题 The following code does not work with iOS5: - (void)loadURL { NSString *path = [[NSBundle mainBundle] pathForResource:self.HTML ofType:@"html"]; NSString *markup = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; [self.webView loadHTMLString:markup baseURL:nil]; [markup release]; } - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType ==

How to get all HTML elements in UIWebView

一笑奈何 提交于 2019-12-11 07:39:36
问题 I have loaded an UIWebView with .rtf file. Now, I want to get all HTML elements or elements present inside the UIWebView . Is there any method available to get it? Thanks for your answers. 回答1: You could use JavaScript to get the element... NSString *javaScript = @"document.getElementById( YOU ID );"; NSString *response = [webView stringByEvaluatingJavaScriptFromString:javaScript]; Hope that helps... 回答2: You can get all of the HTML content of your UIWebView with the call: NSString

iPhone - How to preload a local file in a UIWebView?

℡╲_俬逩灬. 提交于 2019-12-11 07:36:43
问题 Is it possible to preload content of a local file with embedded images for a UIWebView? This is how I'm loading the data inside the UIWebView: NSString *urlString = [[NSBundle mainBundle] pathForResource:@"info" ofType:@"html"]; NSString *htmlContent = [NSString stringWithContentsOfFile:urlString encoding:NSUTF8StringEncoding error:nil]; [myWebView loadHTMLString:htmlContent baseURL:nil]; But the UIWebView still needs some time to display the content. Is there any way to put this content into

Using local resources in an iPhone webview

无人久伴 提交于 2019-12-11 07:05:54
问题 Suppose an app has a webview that uses JQuery for example. The server delivers the page with appropriate links to load JQuery, and the view works fine, but I would like it to not need to download JQuery (yes it may be cached, but it won't be the first time the app runs and I would rather not count on it) So I can include the JQuery files with the app, but then how should I embed the links? The server certainly doesn't know the bundle path. I thought I could load the url into a string and then

Ad-Blocker in UIWebView

末鹿安然 提交于 2019-12-11 06:57:19
问题 From iOS 9 Apple start ad-blocker in safari by installing the blocker and use it as described here. My question is how to use ad-blocker for UIWebView ?? I mean if my app has UIWebView and I wanted to block ad-mob in my UIWebView . If it is possible then how achieve this, if not then is there any alternative solution is available. Already done R&D I already go through many site and apple doc's I didn't get any source which explains my question. In apple doc I got NEFilterProvider. According