uiwebview

how does one check if UIWebView is empty or not

限于喜欢 提交于 2019-12-21 04:37:04
问题 I need to check if a webview when completed loading has any content or not. What I require is simple. Its a small webview strip at the bottom of my pages (like an advert) I call NSURLRequest *request=[NSURLRequest requestWithURL:adURL]; [gWebView loadRequest:request]; I get the callback -(void)webViewDidFinishLoad:(UIWebView *)webView { But in my scenario the webview shall return empty and sometime it shall have data. I do not want to show the webview if my server php file returned nothing.

launching UIWebview with specific url

一笑奈何 提交于 2019-12-21 04:13:16
问题 I currently have a view with four buttons, and would like to be able to launch UIWebview with a specific url for each different button. I currently am able to launch safari externally with the urls. I know I can have the code to show the UIWebview within each button, and can set the url withing the viewDidLoad of the UIWebview, but I need a way to load a specific page depending on which button was pressed. Regards 回答1: somtheing like this should be called in the IBAction for the buttom click.

What File Types are Supported by WKWebView?

倖福魔咒の 提交于 2019-12-21 04:11:27
问题 UIWebView supports a whole list of file types, as detailed in this Apple Technical Q&A doc: In addition to HTML content, UIWebView can display specific document types. iPhone OS 2.2.1 supports the following document types: Excel (.xls) Keynote (.key.zip) Numbers (.numbers.zip) Pages (.pages.zip) PDF (.pdf) Powerpoint (.ppt) Word (.doc) iPhone OS 3.0 supports these additional document types: Rich Text Format (.rtf) Rich Text Format Directory (.rtfd.zip) Keynote '09 (.key) Numbers '09 (.numbers

Using Retina images in a local UIWebView

佐手、 提交于 2019-12-21 04:10:32
问题 For some reason, I cannot get a UIWebView to "play nice" with my new Retina images. The issue, step-by-step: I am loading a series of HTML help files out of the bundle. My code loads different HTML files if it's an iPhone 4 ( LWERetinaUtils below is a util class I have written). I have read in this question that it is not possible for the UIWebView to auto-detect the @2x indicator - and experienced that personally, hence this approach. if ([LWERetinaUtils isRetinaDisplay]) htmls = [NSArray

iOS loadHtmlString in UIWebView doesn't work with Javascript

和自甴很熟 提交于 2019-12-21 04:06:46
问题 I have a iOS app to load a html string which refer to external css file and javascript file in the same directory. Here is my html file: <html> <head> <meta name="viewport" content= user-scalable="no", width="device-width" /> <meta http-equiv="Content-Type" content="text/html"; charset="UTF-8"/> <link rel="stylesheet" type="text/css" href="mystyle.css" /> <script type="text/javascript" src="myjavascript.js"></script> </head> The css file works fine but it seems the js file never loaded. What

is it possible to use iframe in UIWebView?

a 夏天 提交于 2019-12-21 04:05:33
问题 i want to add a facebook like button in my app. in developer.facebook.com i couldn't fine anything about that. is it possible to use iframe created by facebook like button in UIWebView? it think if its possible then i can add a UIWebView in my app which use that iframe. thanx. please write some example code. 回答1: Yes that is possible you can use the iframe in webview. You need to load the webview with the HTML string. You can also find the related code of HTML for iframe if you search over

Control text selection behavior in iOS Mobile Safari and/or UIWebView?

你。 提交于 2019-12-21 03:53:17
问题 I have a long HTML document that contains multiple paragraphs. When I try to select the text either in Mobile Safari on iOS or in a UIWebView, the following happens: At first, I get character-level precision on my selection. Then, as I select more, the precision drops to two lines of text and eventually to whole paragraphs. There is no way to end my text selection exactly where I want. When I set the CSS contentEditable property to true , I retain the character-level precision, but the

How does the iBooks App format the text on separate pages?

有些话、适合烂在心里 提交于 2019-12-21 03:48:53
问题 Looking at the iBooks App, I was wondering how it accomplishes to format text (probably a very simple txt file) so that it is NOT SCROLLABLE but divided on separate pages. I'd like to achieve the same, but only with editable text. Where would I need to start? UITextView doesn't work as it scrolls. Even if I set the pagingEnabled property to YES, it won't do the job. It seems as if I need to LIMIT the amount of text I can put on a certain page. Is there a function to LIMIT the input of a

UIWebView and define dictionary

寵の児 提交于 2019-12-21 03:42:12
问题 I had the copy and define option built in with the UIWebView. It worked just fine on the iPad but on the iPhone, it only works once when I highlight the text and use the dictionary and the second time I tried it, it doesn't show up the popover. Any idea? UPDATE: I am getting the following error as well when dismissing the dictionary on the iPhone: Unbalanced calls to begin/end appearance transitions for UIFallbackPresentationViewController UPDATE: When I present a UIAlertView and cancel's it

Is it possible to send a hash tag to a file url in UIWebView?

拈花ヽ惹草 提交于 2019-12-21 03:36:30
问题 I want to load a html page from a file, and append a hash tag to it. Is this possible? I have tried NSString *filePath = [[NSBundle mainBundle] pathForResource:@"someFile" ofType:@"html"]; NSURL *fileUrl = [NSURL fileURLWithPath:[filePath stringByAppendingFormat:@"#hashtag"]]; [self.webView loadRequest:[NSURLRequest requestWithURL:fileUrl]]; NSLog(@"fileUrl = %@, reachable? %d", fileUrl, [fileUrl checkResourceIsReachableAndReturnError:nil]); but this tries to look for the file someFile.html