How can I set the titlebar title for a modal view controller?
self.title = @"My View";
Doesn't work when my view is pre开发者_开发问答sented modally.
You must write following code for presenting modalView Controller..
yourModelController =[[Yourmodelcontroller alloc]init];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController: yourModelController];
[[self navigationController] presentModalViewController:controller animated:YES];
[controller release];
Then in the viewDidLoad
-method you need to write:
self.title =@"My View";
Please try this one:
self.title = NSLocalizedString(@"My View", @"Comment goes here");
You can use UINavigationItem property in ViewDidLoad() to set the navigation bar's title.
Swift Code:
self.navigationItem.title = "Bar Title"
精彩评论