uiwebview

Memory leak with UIWebView

好久不见. 提交于 2019-12-05 04:57:30
My project is a hybrid static lib for showing a UIWebView with some JS to control the logic. When I use 64bit and run demo on iOS 8/iPhone 6, the memory keeps going to 30M or more! When I use generation in instrument, the increased memory usage is almost all from webcore; does it means there are leaks in JS code? I can't find a leak when I use Safari to run similar JS directly. When I release the UIWebView, the memory is still not freed; I tested with instrument allocation. There are some webcore and (non - object) still in memory, what can I do to release them? 0JavaScriptCore WTF::MallocHook

UIWebView does not load the URL

怎甘沉沦 提交于 2019-12-05 04:57:28
问题 I have very small problem while loading the URL in UIWebView . I have one UIButton , on clicking of it, I add the UIView which contains UIWebView , UIButton & Title bar . Code used is as follows - [self.view addSubview:vwOnline]; vwOnline.bounds = self.view.bounds; //Load webview NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", objWine.strOnlineURL]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [wbvwOnline loadRequest:request]; - (void)webViewDidStartLoad:

iPhone - Save URL without setURL:forKey: and NSURL

无人久伴 提交于 2019-12-05 04:48:38
问题 Is there anyway to save a URL with NSUserDefaults without setURL:forKey: that is only available to iOS 4.0 and later? I am loading HTML files locally with fileURLWithPath, and it starts at an intro page and the user can click through to whatever. For now, everytime a user starts over it loads back default to intro.htm. I would like to be able to save their current page to NSUserDefaults on viewdiddissapear and reload it next time, but can't find any solutions besides setURL:forKey:. Anyone

Embedded video playing with multiple orientations?

馋奶兔 提交于 2019-12-05 04:14:40
问题 I want to play dailymotion and youtube videos in my UIWebView control. And I'm using following embedded html code to play and it's working fine. But as device is being rotate, it's not resetting accordingly and if I call the following code again it will start to play video from beginning. NSString* embedHTML = @"<html><head><style>body {\"background-color:transparent;color:black;\"}</style></head><body style=\"margin:0\"><embed id=\"yt\" src=\"%@\"type=\"application/x-shockwave-flash\"width=\

How can I prevent keyboard autocompletion in MobileSafari/UIWebView?

谁都会走 提交于 2019-12-05 04:13:27
I'm implementing my own autocompletion on an <input> field inside a UIWebView, and the built-in keyboard autocompletion interferes with the user experience. Is there a way to use HTML or Javascript to signal to iOS that it shouldn't try to autocomplete? In my comments I mentioned using the html attribute autocomplete but I tested it, and it doesn't address your issue. However, there is an attribute specific to Mobile Safari which may help. You could try turning off autocorrect like so: <input type="text" id="your-field" autocorrect="off" /> 来源: https://stackoverflow.com/questions/6461101/how

Swift stringByEvaluatingJavaScriptFromString

若如初见. 提交于 2019-12-05 04:11:29
I try to use some javascript on my WebView with the new stringByEvaluatingJavaScriptFromString function I m not quiet familiar with the syntax so i tried func stringByEvaluatingJavaScriptFromString( "document.documentElement.style.webkitUserSelect='none'": String) -> String? as shown here https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/index.html#//apple_ref/occ/instm/UIWebView/stringByEvaluatingJavaScriptFromString : but i get a error that "Expected '.' separator" The method you are trying to call is prototyped as the following: func

highlight text in UIWebView

耗尽温柔 提交于 2019-12-05 03:52:27
问题 I have UIWebView for displays HTML page articles. I need to search string or text and highlight. I referred this document http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/. But nothing happen. - (void)viewDidLoad { [wbCont loadHTMLString:webString baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]]; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // getting an NSString NSString *savedValue = [prefs stringForKey:@"got"]; NSLog(@"saved is

How to prevent UIWebView video from getting remote control events

血红的双手。 提交于 2019-12-05 03:45:52
I am using UIWebView in an iOS app to play YouTube videos but to provide native experience, I've implemented playback controls using UIKit. So the UIWebView is only used to display video. I've also implemented -remoteControlReceivedWithEvent: to allow control from Control Center and controller buttons on earphones. But it seems that UIWebView automatically handles remote control events from the earphones. This is a problem because when you toggle play/pause, my code would pause the video and then UIWebView will toggle it again to play the video. Is there anyway to prevent this from happening?

Change textcolor of UIWebView

旧城冷巷雨未停 提交于 2019-12-05 03:37:09
I am making an epub reader, into which I am loading HTML pages in my webview : [_webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:_pagesPath]]]; Now I want to change background color and and text color of my the HTML pages. I changed background color of my webview using, self._webview.backgroundColor = [UIColor blackColor]; self._webview.opaque = NO; That's working, but I also want to change the text color of my webview. How do I do this? In this this code color:#fff tag use for text color #fff use black color NSString *webStr =@"Your text use"; [self._webview

How to set a custom keyboard for UIWebView

天大地大妈咪最大 提交于 2019-12-05 03:31:41
How to show a custom keyboard and Input Accessory View for a editable UIWebView for iOS7 and up. i.e: How can i set and make use a value from [UIWebView setInputView:] and [UIWebView setInputAccessoryView:] It would be helpful to understand what you're trying to do? You can either be trying to force a specific type of keyboard such as numeric, email, etc. that will use the keyboard the user has explicitly installed on their device (or the system one). In order to do this, you can reference this apple doc which shows you the 'type' attribute to add to an tag. Otherwise you are asking about