uiwebview

Get video URL from AVPlayer in UIWebView

和自甴很熟 提交于 2019-12-23 07:37:07
问题 I am trying to detect URL of current video playing from UIWebView, with this method : func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { NotificationCenter.default.addObserver(self, selector: #selector(playerItemBecameCurrent(notification:)), name: NSNotification.Name("AVPlayerItemBecameCurrentNotification"), object: nil) //urlTextField.text = webView.request?.url?.absoluteString return true } func

Display multiple views serially using GCD

帅比萌擦擦* 提交于 2019-12-23 05:12:35
问题 I have 4 tabs and all have UIWebView . I want that the first tab should load and displayed immediately without waiting for others to load. For which I did this in UITabBarController class: for(UIViewController * viewController in self.viewControllers){ if(![[NSUserDefaults standardUserDefaults]boolForKey:@"isSessionExpired"]) { if((int)[self.viewControllers indexOfObject:viewController] != 4) { viewController.tabBarItem.tag = (int)[[self viewControllers] indexOfObject:viewController];

Detect UIWebView links without click

笑着哭i 提交于 2019-12-23 05:07:52
问题 I was wondering is there any possible way to detect a link in UIWebView without click on urls ? for example if page has PDF file automatically get its link. I know with webview's delegate I can detect clicked urls like this : func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { if navigationType == .linkClicked { print(request.url?.absoluteString) } return true } but is there any possible way to detect links without

Why UIWebView work so slowly when loadHTMLString with UIWebView?

久未见 提交于 2019-12-23 05:03:31
问题 It take about 10s to loadHTMLString in my APP, who can point out what's the problem? - (void)viewDidLoad { [super viewDidLoad]; webView = [[UIWebView alloc]initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH, 480)]; [webView setBackgroundColor:[UIColor clearColor]]; [webView setOpaque:NO]; webView.delegate = self; [scrollView addSubview:webView]; } After enter the view, If I receive message: - (void)updateJournalView:(NSArray *)journals { NSString *descHtml = [self getHtmlDesc:journals]; [webView

iPhone : webView:shouldStartLoadWithRequest:navigationType timing problem

元气小坏坏 提交于 2019-12-23 04:55:34
问题 I have a WebView which is loading and HTML String and I want it to catch clicks on links. For that I need to use the webView:shouldStartLoadWithRequest:navigationType method. The problem is that this method gets called multiple times before the HTML content is fully loaded and I only want to start catching clicks at that moment. The question is how to know when the HTML content is fully loaded ? I thought it was simple so I created a boolean as an iVar of the ViewController containing the

How to set Proxy in web-view swift?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 04:53:32
问题 I am trying to set proxy. Following is my code. func startLoading() { let proxy_server: CFString = "abc.somecompanyname.com" // proxy server let proxy_port: CFNumber = 1234 // port //"request" is your NSURLRequest let url: NSURL = request.URL! let urlString: String = url.absoluteString let urlStringRef: CFString = (urlString as CFString) let myURL: CFURLRef = CFURLCreateWithString(kCFAllocatorDefault, urlStringRef, nil) let requestMethod: CFString = "GET"//CFSTR("GET") // let myRequest =

programmatically handling a text field within a uiwebview

烈酒焚心 提交于 2019-12-23 04:52:26
问题 I have a webpage with a text field and a submit button. That webpage is loaded within a UIWebView. How would I programmatically press the submit button for that webpage? Alternatively, how would I programmatically make the text field within the webpage the first responder and display the soft keyboard? Just programmatically re-create the same behavior as if the user had touched the text field on the webpage. I would like to make the assumption that the source of the page is unknown. This is

Getting image size from HTML

守給你的承諾、 提交于 2019-12-23 04:51:44
问题 I'm parsing an RSS feed from a blog, and putting the HTML of a post inside a UIWebView . But now I would like to change the size of the images to fit the iPhone screen. I'm trying with the following replace HTMLContent = [HTMLContent stringByReplacingOccurrencesOfString:@"width=\"480\"" withString:@"width=\"300\""]; But doing like this I'm replacing only the images with 480 width. And moreover I'm not changing the height! Do you know if there is a way to replace any width with 300, and

how to clear webview cache in ipad

非 Y 不嫁゛ 提交于 2019-12-23 04:45:12
问题 Here i have load the content in the uiwebview using [webView loadHTMLString:[theApp.contentArr objectAtIndex:spineIndex] baseURL:url]; after going back and come i need to clear the cache here i have tried these kinds of methods to clear the cache: [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML = \"\";"]; [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; // remove all cached responses [[NSURLCache sharedURLCache]

uiwebview within uiscrollview

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 04:25:01
问题 I am having an issue with a uiwebview within a scrollview. In this scrollview, there is a "header" view at top and "bottomview" which is the webview. I am loading the data into the webview using loadHTMLstring method. What I am trying to do is that when I zoom, it should zoom in only on the bottom portion, not the top part. This is very similiar to the native email app on the iphone. I have been at this for 2 days now with no luck. Any help would be appreciated. thanks in advance. 回答1: In