I have a nav bar application that uses a custom header that I created like this:
@implementation UINavigationBar (Background)
-(void)drawRect:(CGRect)rect{
UIImage *customLogo = [UIImage imageNamed:@"UINavBar.png"];
[customLogo drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
I’m trying to get rid of the title at the top without getting rid of the word showing up in the Navigation Item. These are the variables I have set up in my viewController:
NSArray *tableDataSource;
NSString *CurrentTitle;
NSInteger CurrentLevel;
Here’s where I think the problem is:
if(CurrentLevel == 0) {
NSArray *tempArray = [[NSArray alloc] init];
self.tableDataSource = tempArray;
[tempArray release];
self.tableDataSource = [self.industryData objectForKey:@"Rows"];
self.navigationItem.title = @"Back";
}
else
self.navigationItem.title = CurrentTitle;
}
If I set the navigationitem.title = nil, I can no longer back up. Is there a way that I can make the title disappear without losing it in the navigationcontroller?
If you want the button to say
backyou are going the wrong way about it.You need some code like this placed in the view controller
Now when the next page is pushed onto the stack the back button will say
backinstead of thetitleof the controller we just came from.Now if you want the back button to say the
titleof the previous view controller but you do not want the title to be displayed across the top when you are currently viewing the view controller. You can simply set the title view to a blank view like this: