I have an app tab based with a navigation controller,
the title in the navigation bar shows fine in the root page for the tab,
but when I push another view controller, on top, I cannot set the title for this view
this is the code I use for the root page and the pushed page,
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *lava = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]autorelease];
lava.backgroundColor = [UIColor clearColor];
lava.text = @"About us";
lava.textAlignment = UITextAlignmentCenter ;
lava.textColor = [UIColor whiteColor];
lava.font = [UIFont fontWithName:@"DroidSans-Bold" size:(46)];
lava.shadowColor = [UIColor blackColor];
lava.shadowOffset = CGSizeMake(2, 3);
self.navigationItem.titleView = lava;
}
so, what is missing to set my title on the nav bar?
thanks!
You could try
self.navigationController.navigationItem.titleViewOr if you use iOS5 or later..
Call this once in
viewDidLoadin your rootViewController and then you can just useself.title=@"foo"everywhere.