开发者

How can I set the titlebar title for a modal view controller?

开发者 https://www.devze.com 2023-03-22 11:10 出处:网络
self.title = @\"My View\"; Doesn\'t work when my view is pre开发者_开发问答sented modally.You must write following code for presenting modalView 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

精彩评论

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

关注公众号