Sheehan Alam Sheehan Alam - 1 year ago 92
Objective-C Question

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

self.title = @"My View";

Doesn't work when my view is presented modally.

Answer Source

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 u need to write

self.title =@"My View";

It will work definitely. Hope it will help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download