ios 如何获取html网页上的txt文件
1个回答
2014-11-12
展开全部
[objc] @property (strong,nonatomic)UIWebView *webView;
@property (strong,nonatomic)NSString *currentURL;
@property (strong,nonatomic)NSString *currentTitle;
@property (strong,nonatomic)NSString *currentHTML;
[objc] view plaincopy
---------------------------------
[objc]
[objc]
-(void) webViewDidFinishLoad:(UIWebView *)webView {
[UIApplicationsharedApplication].networkActivityIndicatorVisible =NO;
self.title = [webViewstringByEvaluatingJavaScriptFromString:@"document.title"];//获取当前页面的title
self.currentURL = webView.request.URL.absoluteString;
NSLog(@"title-%@--url-%@--",self.title,self.currentURL);
NSString *lJs = @"document.documentElement.innerHTML";//获取当前网页的html
self.currentHTML = [webView stringByEvaluatingJavaScriptFromString:lJs];
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询