views:

192

answers:

1

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 title to reflect the title of the web page.

+1  A: 

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.

Alex B