uiwebview

Programmatically take a screenshot of specific area

佐手、 提交于 2019-11-28 21:21:45
问题 Like you can see in my code, I take a screenshot and save it to the photo album. //for retina displays if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale); } else { UIGraphicsBeginImageContext(self.view.bounds.size); } [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

iOS 9 … Are WebView(s) exempt from the App Transport Security Exceptions (ATS) rules that block insecure HTTP hosts?

时光毁灭记忆、已成空白 提交于 2019-11-28 21:16:42
In iOS 9, Apple is blocking insecure HTTP connections for apps, unless specific hosts are whitelisted. http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ Are WebView(s) exempt from these rules for obvious reasons, or are we still expected to whitelist hosts that a browser opens... including all links from a given page? I wasn't sure if this was our responsibility or if that was exempt. SFSafariViewController can show HTTP without the NSAppTransportSecurity key. UIWebView and WKWebView require the NSAppTransportSecurity key mentioned above to display HTTP pages.

Calculate UIWebView height depending on its content

元气小坏坏 提交于 2019-11-28 20:58:59
I have a class named Announcement , it has a Title ( NSString ), a Publishing Date ( NSString ) and a Body ( NSString with HTML content). I would like to display it in a similar way like in the Email app. When you read an email you have the first three "rows" (From, To, Title[date]) and then the content of the email. I would want to create only the "Title[date]" row and then the body. I imagine that it to be a UITableView which has on the first cell my Title and on the second cell an UIWebView . But it seems like the cell has exactly the height of the UIWebView , so my question is this: How

How to set my web view loaded with already login user -iPhone

不想你离开。 提交于 2019-11-28 20:54:58
In my app iam using web view with URL:@"http://www.gmail.com/". This web view was loaded when i clicked a button in the main page / home page (IBAction)webClick:(id)sender { MailViewController *mail = [[MailViewController alloc]initWithNibName:@"MailViewController" bundle:nil]; [self.navigationController pushViewController:mail animated:YES]; } Then the web view was loaded, i used code like thin this in mail view: -(void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = @"http://www.gmail.com/"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest

Reused UIWebView showing previous loaded content for a brief second on iPhone

风格不统一 提交于 2019-11-28 20:52:22
In one of my apps I reuse a webview. Each time the user enters a certain view on reload cached data to the webview using the method :- - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL and I wait for the callback call - (void) webViewDidFinishLoad:(UIWebView *)webView. In the mean time I hide the webview and show a 'loading' label. Only when I receive webViewDidFinishLoad do I show the webview. Many times what happens I see the previous data that was loaded to the webview for a brief second before the new data I

Rendering a UIWebView into an ImageContext

雨燕双飞 提交于 2019-11-28 20:51:46
I am trying to capture the contents of a UIWebView including that which is not visible to the user. i.e. The whole web page even though the user is only looking at the top. Looking around I found the best way to capture a UIView is to retrieve its layer and use renderInContext. However, UIWebView seems to be using its own CALayer implementation which is behaving a lot more like CATiledLayer, although it is still claiming to be a standard CALayer. When I call renderInContext I only get one portion of the web page, up to 940px down, as opposed to the whole page. Has anyone got any ideas on how

Set text for a textfield in UIWebView

人盡茶涼 提交于 2019-11-28 20:48:41
I have a UIWebView and I want to set one of it's text field to certain text. Is that even possible? If so, how can I do that? Thanks Yes you can set the text for a textfield in the UIWebView using javascript As an example if you have a textfield in this form <input id="textFieldID" type="text" value="TextValue"/> Setting value: [theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('textFieldID').value = 'Hello World'"] Getting value: NSString* value = [theWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('textFieldID').value"]; 来源: https:/

UIKeyboardAppearance in UIWebView

泄露秘密 提交于 2019-11-28 20:48:08
With iOS7, we saw the introduction of UIKeyboardAppearance . Works great when applied to UITextView , but, as Apple states , the UIWebView does not conform to the UITextInputTraits protocol. Although the UIWebView class does not support the UITextInputTraits protocol directly, you can configure some keyboard attributes for text input elements. For example, you can include autocorrect and auto-capitalization attributes in the definition of an input element to specify the keyboard’s behaviors, as shown in the following example. Has anyone figured out the magical HTML attribute to set for

How can I add an external stylesheet to a UIWebView in Xcode?

本秂侑毒 提交于 2019-11-28 20:33:01
I have looked at various similar questions and answers and still cannot get this to work, so I'm adding my own question: I'm playing with UIWebView. I can create a working html page with inline CSS. I cannot figure out how to get the CSS to load if it is in a file in the app resources group. My code is: NSString *path = [[NSBundle mainBundle] pathForResource:@"webViewPage2" ofType:@"html"]; NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path]; NSString *htmlString = [[NSString alloc] initWithData: [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding]; webView

UIWebView Expose Objective C to JavaScript

◇◆丶佛笑我妖孽 提交于 2019-11-28 20:23:02
How would I expose an Objective-C method within JavaScript when using the iPhone SDK when using the UIWebView ? Any help would be appreciated! The best way to do this would be through a custom link, and then use the UIWebView delegate method -webView:shouldStartLoadWithRequest:navigationType: to trap requests. When you see a request come through with your link in it, you know your action has been triggered. Lee There is an example application in the QuickConnectiPhone framework that shows you how to do this. QuickConnectiPhone also gives you a JavaScript function called 'makeCall'. You pass it