uiwebview

iOS Swift : can't Retrieve current url loaded in UIwebView

萝らか妹 提交于 2019-12-05 19:31:05
i am working in webview application iOS swift : problem i am facing is i want to get each url which webview displays : upon urls i have to perform some if else checks . but i could not get the urls which webview loads. webview is displaying fine results and loading urls upon clicking . i want to fetch all urls which webview navigates on.. import Foundation import UIKit class seconVC: UIViewController { var toPass:String! var touser:String! var toPassing:String! @IBOutlet weak var webV: UIWebView! @IBOutlet weak var L_back: UIBarButtonItem! @IBOutlet weak var R_frwrd: UIBarButtonItem! override

UIWebview full screen size

ぃ、小莉子 提交于 2019-12-05 19:16:06
问题 I am trying to display a pdf in a UIWebview using the entire screen of the device, except the status bar and top bar. So far, I created IBOutlet UIWebview *webview; in my .h file. I connected the webview in my storyboard and wrote the following code in my .m file: - (void)viewDidLoad { [super viewDidLoad]; webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)]; webview.scalesPageToFit = YES; webview.autoresizesSubviews = YES; webview.autoresizingMask=

Improving UIWebView initialization time

妖精的绣舞 提交于 2019-12-05 18:55:09
My company uses a UIWebView to display ads. The issue I'm having is that initializing a UIWebView appears to be expensive; profiling with Time Profiler shows [UIWebView alloc] initWithFrame:CGRectMake(0,0,500,500)] to take 31–40ms. This is enough to cause noticeable frame drops in games running at 60 FPS. Is there a way to workaround this slow initialization time? My current ideas are to create a UIWebView when the app launches (but before gameplay has started), and reuse that (potentially creating a pool of them to reuse, like how UITableViewCell works) or to try and see if WKWebView has

iOS UIWebView with changing content size

孤者浪人 提交于 2019-12-05 18:32:52
I have a UIWebView which i've set the height of the WebView to [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue]; This works fine but on my webpage I have a menu which is expandable, so when the webpage is changing it's height the WebView doesn't increase/decrease it's size. Any tips how I can make my UIWebView change height dynamically when the webpage is changing its size? I would very much like to keep the UIWebView's size = webpage so I never have to scroll in the WebView. you can set sizeToFit property and again set Frame of UIWebView in

How to get requesting UIWebView from inside of NSURLProtocol

牧云@^-^@ 提交于 2019-12-05 18:18:11
My app uses subclassing of NSURLProtocol. There are several UIWebViews in the app and for specific algorithm implemented in NSURLProtocol I need to know which one of the UIWebViews sends the request. My understanding is that object returned by [self client] should be somewhat connected with requesting object. But neither NSURLProtocolClient (that is the protocol implemented by object returned by [self client]) nor underlying object _NSCFURLProtocolBridge have any properties/methods to get the sender of the request. Can anyone help me with ideas? Pradeep NSURLRequest has a method called

UIWebView and click link

六月ゝ 毕业季﹏ 提交于 2019-12-05 17:23:44
I know that most likely the answer is very obvious, but I've looked everywhere on the internet and I have not found anything. I use this method to see if the user presses on the WebView -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; { I can assure you that it works. What I want to do is to make different actions according to the id es <a id="hello" href="..."><img src="..." /></a> once the delegate detect "touch click" on the img with the "hello" id, I would do some custom stuff, like [self

Pass response from AFHTTPRequestOperation to UIWebview

梦想的初衷 提交于 2019-12-05 16:47:06
My code is making two requests to the server. One into the uiwebview directly and one with the AFHTTPRequestOperation. I'd like to use the AFHTTPRequestOperation and just pass the response into my uiwebview. What is the correct syntax for passing the response into the uiwebview and not loading it again? How do I do that without calling twice from the server? I still want to be able to test the success or failure of the load request and also send username and password to connect to the url. - (BOOL)textFieldShouldReturn:(UITextField *)textField { [itemField resignFirstResponder]; NSUserDefaults

Link follows when using UIWebView+AFNetworking

落花浮王杯 提交于 2019-12-05 16:43:31
I'm trying out AFNetworking 2.0+'s new UIKit+AFNetworking extension for UIWebView , loadRequest:progress:success:failure: . So far so good, but after the initial request is made, additional requests caused by user interaction falls back to the built-in loadRequest: of plain UIWebView . I'd much prefer that all requests went through the AFNetworking improved one. Preliminary, I'm thinking I should override as much as possible by returning NO in shouldStartLoadWithRequest and call loadRequest:progress:success:failure: manually, but it seems a little heavy-handed. Is this the intended way or am I

Migrate UIWebView to WKWebView

坚强是说给别人听的谎言 提交于 2019-12-05 16:17:57
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: import UIKit class ViewController: UIViewController, UIWebViewDelegate { override func viewDidLoad() {

Intercept unused tap events in a UIWebView

拥有回忆 提交于 2019-12-05 15:57:08
I'm working on an iPad app which is based on a UIWebView: to explain it in the simplest possible terms, the app shows one big interactive webview and in addition it supports custom gestures. I need to catch events that represent single taps on the webview, but only when the taps have not already been consumed by the webview (i.e. they are not the beginning of a scroll/zoom operation, they are not taps on links, they are not taps that trigger some javascript). The UIWebView is very greedy with its events, and in my experience it tends not to propagate them, even when they are not consumed. To