uiwebview

Dimiss keyboard when editing textfield on UIWebview

帅比萌擦擦* 提交于 2019-12-10 11:01:18
问题 I'm opening a web page on UIWebview and this page has a textfield and a virtual keyboard the to enter password. But when edit the textfield iPhone virtual keyboard appears as well. I wanted to dismiss iPhone keyboard and on the same time continue editing the textfield. I have tried the following but it did not work. [webView stringByEvaluatingJavaScriptFromString:@"document.activeElement.blur()"]; And also tried to register for Keyboard notification so I can dimiss the keyboard but did not

UIWebView capture post

两盒软妹~` 提交于 2019-12-10 10:59:24
问题 I am looking for a starting point on a project that needs to display a UIWebView on an iPad. THe catch is that the HTML will be generated by the pad and displayed in the UIWebView, and will contain many input controls. What is needed is a way to grab the contents of these controls after the user has completed entry similar to how I would do it on a server. I need to grab this entered data on the iPad without an actual submit. Does anyone know the starting point for this type of interaction?

How can i know web view is loading completed

依然范特西╮ 提交于 2019-12-10 10:48:20
问题 i have web view in that i am loading pdf file . pdf file has 2 mb size so it tacking time. i want to add indicator . for that how can i know my file is loaded in web view ? ... 回答1: James P has the right answer (^'ed), but here is the code to show and hide the indicator. After you've registered with the UIWebViewDelegate... - (void)webViewDidStartLoad:(UIWebView *)webView { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; // Other stuff... } And then - (void

UIWebview open URL in mobile safari using javascript

[亡魂溺海] 提交于 2019-12-10 10:45:52
问题 So I'm building an HTML5 game using phaser and I have a button that calls a URL in javascript like this: window.open("http://google.com", "_blank"); This works great on desktop opening in a new window, I'm also able to get it to open in the default browser on an android device via webview as well. But on iOS using a UIWebView in swift I'm using the following code func webView(webView: UIWebView!, shouldStartLoadWithRequest request: NSURLRequest!, navigationType: UIWebViewNavigationType) ->

How do I change the height of a table cell that has already loaded?

情到浓时终转凉″ 提交于 2019-12-10 10:28:50
问题 Currently I have webviews loading in customized uitableview cells. The problem is the web views have variable sizes. In webViewDidFinishLoad I am able to set the size of the web view based on the actual size of the html document just fine. My problem is the table cells which have already had their height set in heightForRowAtIndexPath before the web views having finished loading. How can I change the height of a table cell after it has already been loaded? Ideally I feel like I should be able

How to save a locally loaded HTML file in UIWebview

我是研究僧i 提交于 2019-12-10 10:15:37
问题 I am writing a rich text editor using UIWebView. To do this, I used a template file for a starter. Then when user finishes editing but has not published yet, I would like to save the current content into a back-up html file in case app corrupts. How do I do that? 回答1: Here you go... buddy NSFileHandle *file; NSMutableData *data; const char *bytestring = "black dog";//In your case html string here data = [NSMutableData dataWithBytes:bytestring length:strlen(bytestring)]; NSString *path = /

How to manipulate DOM in UIWebView in iOS

依然范特西╮ 提交于 2019-12-10 10:04:56
问题 I am using a UIWebView in my app. I want to call a objective-c function when user clicks a link in a website in UIWebView. Is there a way to do this? Does UIWebView allow to change it? 回答1: First hook it. [yourwebview setDelegate:self] Use the following delegate method webView:shouldStartLoadWithRequest:navigationType Like: - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *url = request.URL;

Migrate UIWebView to WKWebView

穿精又带淫゛_ 提交于 2019-12-10 09:34:43
问题 Within my iOS app I am attempting to migrate my old UIWebView code to WKWebView since WKWebView is, in theory, faster and more efficient than UIWebView. I have looked at a bunch of tutorials (like here and here and here) on the internet but cant find anything that explains how to simply add a WKWebView to my app progmatically. Can someone point me to a simple tutorial or explain in the comments how to convert this code to WKWebView progmatically? thanks in advance. View Controller.swift:

how to use custom font in html pages for UIWebView?

馋奶兔 提交于 2019-12-10 09:24:02
问题 I am having the "Futura.ttf" font file. I am displaying a HTML page in the UIWebView, but my requirement is that i want to use the custom font in my css file. so is there any way that i can use the custom font in my css file ??? All suggestions are welcomed. Thanks. 回答1: It is possible to load custom fonts into your UIWebView in iOS3.2 and above. Add the font to your bundle (see here) then just reference the font in your UIWebView's stylesheet like you would any other font: <style type='text

scalesPageToFit broken on UIWebView after keyboard is shown?

痞子三分冷 提交于 2019-12-10 07:24:31
问题 I have this meta tag: <meta name="viewport" content="width=768, minimum-scale=1.0, user-scalable=no" /> And I am setting scalesPageToFit: webView.scalesPageToFit = YES; At first this works correctly. When I go from portrait to landscape it zooms in so the width of the device is always 768px. I can go back and forth with no issues (portrait <-> landscape). As soon as I activate the virtual keyboard, whether it be through a contentEditable or text area, it stops working completely, even after I