开发者

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" 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜