uiwebview

Why timer stops when scrolling in UIWebView iPhone? [duplicate]

偶尔善良 提交于 2019-12-18 03:41:47
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: UIScrollView pauses NSTimer until scrolling finishes I am having a bit of trouble figuring out why the NSTimer stops as soon as I scroll in the UIWebView. Please take a look at the following code (I know this isn't a homework site, but I honestly am stuck): - (void)viewDidLoad { [super viewDidLoad]; NSString *address = @"http://en.m.wikipedia.org/wiki/"; NSURL *url = [NSURL URLWithString:address]; NSURLRequest

Reliably opening App Store links from a UIWebView

大憨熊 提交于 2019-12-18 03:17:46
问题 I have an app that will display web pages within a UIWebView. The pages it shows may contain links to other iPhone apps on the App Store. In a normal browser on a desktop computer, clicking these App Store links would take me through a number of URL redirects and eventually end up opening iTunes and taking me to the page for that App. Is there a way to ensure that when an App Store link is clicked inside my UIWebView that the App Store app on the iPhone will open and show the app? What I've

Turn a page (a UIWebView) with an animation

南楼画角 提交于 2019-12-18 03:01:06
问题 I have a webview, which shows the pages of a ebook. I want to switch from one page to the next page with a page curl animation. By now, I know how to switch the page and how to apply a page curl animation on the webview. But how do I apply the curl animation in a way that it looks like flipping from one page to another? 回答1: Here's some downloadable code with an example of how to do this. 回答2: I think you required to use "WebKit CSS animation" for getting animation in UIWebView. Read DashCode

UIWebView and JavaScriptInterface in Swift

≯℡__Kan透↙ 提交于 2019-12-18 02:48:03
问题 How can I to create the JavascriptInterface channel from my web site to my UIWebView? Example in Android: webView.addJavascriptInterface(new WebAppInterface(this), "Android"); And from this JavascriptInterface I would like to draw the methods, as for example: func webViewDidStartLoad(webView: UIWebView) or myActivityIndicator.startAnimating() How can I do? 回答1: For WKWebView: source here JavaScript function callNativeApp () { try { webkit.messageHandlers.callbackHandler.postMessage("Hello

How to get coordinates (CGRect) for the selected text in UIWebView?

≯℡__Kan透↙ 提交于 2019-12-17 23:27:48
问题 I have simple UIWebView with loaded html. I want to show the PopoverView pointed to the selected text. I can get the menuFrame of the UIMenuController and use its rect, but the result isn't as accurate at the corners of the screen as I need. I can calculate the screen size and get menuFrame rect and then I can suppose where the selection may be found, but I want exactly know where is the selected text. Is it generally possible? 回答1: You can use the javascript function getBoundingClientRect()

UIWebView CSS injection using JavaScript

假装没事ソ 提交于 2019-12-17 23:23:22
问题 I'm trying to inject a local css file into an UIWebView that finished loading website such as google etc. I'm trying with JavaScript but with no success. - (void)webViewDidFinishLoad:(UIWebView *)webView { NSString *cssPath = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"styles.css"]]; NSURL *baseURL = [NSURL fileURLWithPath:cssPath]; NSString *js = [NSString stringWithFormat:@"var fileref = document.createElement('link'); fileref

Cordova: Disabling the click delay (300ms click delay) in UIWebView

三世轮回 提交于 2019-12-17 19:56:18
问题 I've been searching solution for this problem all over Internet. But only answer I get is to use Fastclick. Though Fastclick worked for basic uses, it's add JavaScript execution overhead for touch events, which leads to jank. I have found interesting post about "hacked" UIWebView. The author suggests to add some "hack" code: for (UIView* view in webView.scrollView.subviews) { if ([view.class.description equalsString:@"UIWebBrowserView"]) { for (UIGestureRecognizer *gestureRecognizer in view

Fit image of random size into a UIWebview (IOS)

依然范特西╮ 提交于 2019-12-17 19:52:51
问题 I want to fit large image into UIwebview with keeping image ratio same as image view. How can i do it.? My code as follows to fit image in Uiwebview. if image is large then display is not good. CGFloat screenWidth = self.view.frame.size.width; CGFloat screenHeight = self.view.frame.size.height; NSString *htmlString = [NSString stringWithFormat:@"%@", @"<html><head><meta name='viewport' content='user-scalable=yes,width=device-width'></head><body bgcolor='000000'><img src='%@' width='%f' height

Safari web view opening when logging to FB through iOS 9

谁说胖子不能爱 提交于 2019-12-17 19:19:26
问题 I've followed this guide to update my application to use Facebook SDK 4.6 for iOS 9 SDK. When I tap the login button now, a Safari view controller gets presented, whereas it should redirect to the Facebook app(App is installed on iPhone). Is any additional handling required ? It was working fine on previous versions(v4.3.0). 回答1: From a product manager at Facebook in the "Facebook Developer Community" group. And my Reply, still waiting for a response: So it sounds like with SDK 4.6 they are

How to disable Copy and Paste in UIWebView

可紊 提交于 2019-12-17 18:42:25
问题 When a user long-press inside UIWebView, there is a Copy & Paste popup. Is it possible to disable the system from popup the Copy & Paste function, but still allow the user to click on links and goto new pages? 回答1: You can try injecting javascript into the webView. This code works on the iPhone too but only when the page is fully loaded. http://javascript.internet.com/page-details/disable-text-selection.html or http://solidlystated.com/scripting/proper-way-to-disable-text-selection-and