When I push a new tableViewController from the starting screen of the iOS app (I push the Settings screen) the title in the UINavigationController gets clipped until the animation finishes:
That is the NavigationBar in mid animation, and just before the animation finishes, it looks like this:
After a moment, the title changes correctly to "Settings". It's not a big deal, but you can imagine how much it bothers a slightly OCD-prone programmer! :)
Here's the code in the tableViewController where I set the title, nothing special:
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
self.title = @"Settings";
// Hide tabBar when pushed so you cannot switch from the Settings
self.hidesBottomBarWhenPushed = YES;
self.tableView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"bg.png"]];
}
return self;
}
I'm a bit late with the answer, but I tracked down the issue on iOS 5.. When you use the UIAppearance proxy on UINavigationBar, it appears you need to explicitly set the font size, instead of using 0.0 to let it auto set based on orientation.
I was able to fix this by subclassing UINavigationController and putting in the following code:
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
// You should include a conditional here to check for iOS 5, so iOS 6 doesn't have to do any additional work
self.navigationBar.titleTextAttributes = @{
UITextAttributeFont:[UIFont boldSystemFontOfSize:UIInterfaceOrientationIsPortrait(self.interfaceOrientation) || IS_IPAD ? 20.0f : 16.0f],
UITextAttributeTextColor:[UIColor whiteColor],
UITextAttributeTextShadowColor:[UIColor colorWithWhite:0.0f alpha:0.5f],
UITextAttributeTextShadowOffset:[NSValue valueWithUIOffset:UIOffsetMake(0.0f, -1.0f)]
};
}
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