开发者

UIWebView in a UINavigationController

开发者 https://www.devze.com 2022-12-13 14:04 出处:网络
How can I control the title which appears in the UINavigationController with a web page which appears in a UIWebView?

How can I control the title which appears in the UINavigationController with a web page which appears in a UIWebView?

I am trying to get the UINavigationController t开发者_如何学Citle to reflect the title of the web page.


In your webViewDidFinishLoad method, you'll need to call something like

NSString * result = [myWebView stringByEvaluatingJavaScriptFromString:@"document.title"];

Then you'll set up the navigation controller title:

self.navigationItem.title=result;

Unless I'm missing something from your problem description, this should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消