I am wondering why my UINavigationController is not letting me set a title. It lets me change the tint of the navigationBar, but the title and rightBarButtonItem I set just get ignored. Why?
Here's my code:
taps = 0;
UIView*controllerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
controllerView.backgroundColor = [UIColor whiteColor];
controller = [[UIViewController alloc] init];
[controller setView:controllerView];
[controllerView release];
navController = [[UINavigationController alloc] initWithRootViewController:controller];
navController.navigationBar.barStyle = 1;
navController.navigationItem.title = @"Setup";
UIBarButtonItem*item = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonSystemItemDone target:self action:@selector(dismissSetup:)];
navController.navigationItem.rightBarButtonItem = item;
[item release];
[self presentModalViewController:navController animated:YES];
[mp stop];
p.s: I know i'm not releasing some of the stuff I alloc'ed, I do that later!
set: self.title = @"This is my title"; in the viewController
(or in your case set controller.title = @"this is my title";)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With