uiwebview

“Movie Format Not Supported” on iPhone with YouTube player in a WebView

烂漫一生 提交于 2019-12-23 20:01:02
问题 I'm using a UIWebView on iPhone to play YouTube videos. This is working fine most of the time, but not all. Under some circumstances, apparently related to network connection issues, the error "This movie format is not supported." is shown. This same error can be seen in both Safari and the YouTube player under the same circumstances. Unfortunately it has been seen by Apple during the AppStore testing so they've rejected the app. Can anyone suggest methods for detecting and handling the error

Is it correct to invoke stringByEvaluatingJavaScriptFromString of UIWebView in viewDidLoad?

北慕城南 提交于 2019-12-23 19:43:07
问题 I need to set the background of webView at a time when the html has not loaded. In iOS 5.0 this code is correctly working: - (void)viewDidLoad { [super viewDidLoad]; [webView stringByEvaluatingJavaScriptFromString:@"document.body.style.backgroundColor=\"#41414C\";"]; } But in iOS 4.2 nothing happening with background. How can I set background of web View at a time when the html has not loaded? 回答1: In my case I used webview:webViewDidFinishLoad method to evaluate javascript. It was working

How to Pause Media Playback in UIWebView

随声附和 提交于 2019-12-23 18:19:48
问题 I am currently working on a browser that supports multiple tabs on the iPad. Problem is iOS doesn't allow for more than one tab to be playing audio/video at the same time, trying this causes issues to arise such as all the audio to stop and not come back. I have noticed that Google Chrome's browser actually stops the media in the tab that goes inactive. I am wondering how they go about it. I know it is possible to completely stop the media via a [webView loadRequest:NSURLRequestWithString(@

Xcode UIWEBVIEW download , save HTML file and show

旧时模样 提交于 2019-12-23 17:20:03
问题 I want to download a page and show this in WEBVIEW local, but the images are missing. The images are only shown, when I'm online, in offline mode they are missing. How can I solve this? This is the code I used up until now: // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { NSURL *url = [NSURL URLWithString:@"http://livedemo00.template-help.com/wt_37587/index.html"]; //[WEBVIEW loadRequest:reqURL]; // Determile cache file path

iOS Load Image in UIWebView

做~自己de王妃 提交于 2019-12-23 16:33:59
问题 Desperately trying to figue out how to load a local image (saved in local xcode bundle) into the following HTML through a UIWebView. I have spent countless hours following other guides but nothing seems to work, all throw erros. Am trying to add a local image in the following NSString where I have written IMAGEGOESHERE - { [super viewDidLoad]; self.title = _restaurant.title; [[self navigationController] setNavigationBarHidden:NO animated:NO]; self.activityIndicatorView.hidden = NO; [self

UIWebView does not show images on iOS9, and SafariViewController does not load HTML files at all?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 15:34:51
问题 Just found that UIWebView that load HTML string with images embedded does not work correctly to show the image on iOS9 (GM seed), which worked correctly previously on iOS8 . After viewed the WWDC SafariViewController video here and thought Apple wants us to turn to the new framework, which looks quite promising. But problem is SafariViewController does not support loading local HTML files and it only supports HTTP and HTTPS, so far on iOS9 GM seed and Xcode 7.1 beta. I tried to load it using

Remap UIWebView root URL to [[NSBundle mainBundle] bundleURL]

旧街凉风 提交于 2019-12-23 15:19:38
问题 I've got some HTML and some images in my iPhone app, arranged something like: html/ foo.html images/ bar.png I can get bar.png to appear in my UIWebView a couple of different ways -- either loading foo.html from an NSUrl , and walking back up the directory tree from the html directory: <img src="../images/bar.png"/> or by loading foo.html into a string, using loadHtmlString , and using [[NSBundle mainBundle] bundleURL] as the baseURL : <img src="images/bar.png"/> Both of these are kind of

How to define link text color in UIWebView

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 12:44:13
问题 I have a short plain text string, which might contain a weblink . I load it into UIWebView using loadHTMLString and notice that e.g. font style and size are wrong. Can't find anything else, so I embed text inside ad hoc HTML document with CSS (is this REALLY the only way): NSString *myHtml = [NSString stringWithFormat: @"<html><head>" "<style type=\"text/css\">" "body{" "font-family: Helvetica;" "font-size: 20px;" "a {color: #FFF;}" "},</style>" "</head><body>%@</body></html>", myText]; [self

How to get object referece of UIPickerView when it create through html select tag

旧城冷巷雨未停 提交于 2019-12-23 12:34:57
问题 I have a UIWebview contains a html "select" tag, which is shown as a on the screen. When I click the dropdown, the UIWebview brings up a UIWebSelectSinglePicker View automatically, which is shown as . I want to change the picker view background color and text color. How can I achieve this goal? I tried to listen on UIKeyboardWillShowNotification event, but at that moment, this view has not been created. Thanks in advance for any helps. 回答1: I managed to resolve the issue myself. If someone

Embedded Facebook post does not shows properly in UIWebView

怎甘沉沦 提交于 2019-12-23 12:03:11
问题 I'm trying to show facebook embedded post in UIWebView . I get sample code from facebook developer portal and load it into UIWebView . And see only blank screen. Then I put this code in local html file and opened it in Chrome. Still nothing, but i see that embed appeared in half second and then vanished. I try many different embedded html examples with same result. Here is my code: <html> <body> <div id="fb-root"></div> <script>(function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]