本文介绍了除非调用此代码两次,否则iOS UIWebView标题不会更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
网页标题不会更新,除非我调用方法两次
NSURL * yourURL = [NSURL URLWithString:webpageURLLabel.text ]。
NSURLRequest * request = [[NSURLRequest alloc] initWithURL:yourURL];
[webpagePreview loadRequest:request];
webpagePreview.scalesPageToFit = YES;
webpageTitleLabel.text = [webpagePreview stringByEvaluatingJavaScriptFromString:@document.title];
关于如何解决这个问题的建议?
{
webpageTitleLabel.text = [webpagePreview stringByEvaluatingJavaScriptFromString:@ 文件名];
}
webpageTitleLabel.text = [webpagePreview stringByEvaluatingJavaScriptFromString:@ 文件名];
}
以上代码解决了我的问题。
Webpage title doesn't update unless I call the method twice
NSURL *yourURL = [NSURL URLWithString: webpageURLLabel.text ];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:yourURL];
[webpagePreview loadRequest:request];
webpagePreview.scalesPageToFit = YES;
webpageTitleLabel.text = [webpagePreview stringByEvaluatingJavaScriptFromString:@"document.title"];
Any suggestions on how to fix this?
解决方案
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
webpageTitleLabel.text = [webpagePreview stringByEvaluatingJavaScriptFromString:@"document.title"];
}
The above code fixed my issue.
这篇关于除非调用此代码两次,否则iOS UIWebView标题不会更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-25 09:22