uiwebview

Parse HTML with Swiftsoup (Swift)?

痞子三分冷 提交于 2021-02-10 06:41:53
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

Parse HTML with Swiftsoup (Swift)?

情到浓时终转凉″ 提交于 2021-02-10 06:41:46
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

Parse HTML with Swiftsoup (Swift)?

蓝咒 提交于 2021-02-10 06:41:40
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

How to detect a click event in a UIWebView

老子叫甜甜 提交于 2021-02-08 03:05:26
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest

How to detect a click event in a UIWebView

本秂侑毒 提交于 2021-02-08 03:02:00
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest

How to detect a click event in a UIWebView

醉酒当歌 提交于 2021-02-08 03:01:52
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest

get selected text from a uiwebview Xcode

蓝咒 提交于 2021-02-07 03:24:55
问题 I have a UIWebView that loads text from an htmlString . I need when the user selects a part of the text and presses a button, i will be capable of extracting it in order to use it elsewhere, so i am using this code : // The JS File NSString *filePath = [[NSBundle mainBundle] pathForResource:@"HighlightedString" ofType:@"js" inDirectory:@""]; NSData *fileData = [NSData dataWithContentsOfFile:filePath]; NSString *jsString = [[NSMutableString alloc] initWithData:fileData encoding

iOS App - Set Timeout for UIWebView loading

[亡魂溺海] 提交于 2021-02-05 12:56:27
问题 I have a simple iOS native app that loads a single UIWebView. I would like the webView to show an error message if the app doesn't COMPLETELY finish loading the initial page in the webView within 20 seconds. I load my URL for the webView within my viewDidLoad like this (simplified): [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com"] cachePolicy:NSURLCacheStorageAllowed timeoutInterval:20.0]]; The timeoutInterval within the code above does not

iOS App - Set Timeout for UIWebView loading

瘦欲@ 提交于 2021-02-05 12:56:11
问题 I have a simple iOS native app that loads a single UIWebView. I would like the webView to show an error message if the app doesn't COMPLETELY finish loading the initial page in the webView within 20 seconds. I load my URL for the webView within my viewDidLoad like this (simplified): [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com"] cachePolicy:NSURLCacheStorageAllowed timeoutInterval:20.0]]; The timeoutInterval within the code above does not

UIWebView show overlapping status bar in ios-11, iPhone-X, Xcode-9

扶醉桌前 提交于 2021-01-29 10:55:06
问题 I'm loading a web with UIWebView, everything works fine except that the iphoneX is cut off the bar where I put an "OK" button and a label with a title. // webView var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() let myURL = URL(string: "https://google.com") let myRequest = URLRequest(url: myURL!) webView = WKWebView(frame: CGRect( x: 0, y: 60, width: self.view.frame.width, height: self.view.frame.height - 60 ), configuration: WKWebViewConfiguration() ) //webView