John Smith
John Smith

Reputation: 12797

UIWebView in a UINavigationController

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.

Upvotes: 0

Views: 876

Answers (1)

Alex
Alex

Reputation: 919

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.

Upvotes: 1

Related Questions