UINavigationItem title location not updating on rotation
This feels like a silly question but for the life of me, I can't figure it
out. In short, I'm manually adding a navigation bar to my view and it
contains a UINavigationItem.
I've added one UIBarButtonItem and I'm setting the title like so:
UIBarButtonItem * doneButton = [[UIBarButtonItem alloc]
initWithTitle:@"Done" style:UIBarButtonSystemItemDone target:self
action:@selector(doneTapped:)];
[doneButton setBackgroundVerticalPositionAdjustment:20
forBarMetrics:UIBarMetricsDefault];
doneButton.tintColor = [UIColor blackColor];
self.navItem = [[UINavigationItem alloc] init];
[self.navItem setLeftBarButtonItem:doneButton];
self.navItem.title = @"Help Directory";
[self.navBar setItems:@[self.navItem]];
This works fine will I reach this view controller. Problems start to arise
during rotation. The title stays in the exact same location. Here's the
portrait version:
Here's the landscape version:
This bug appears in earlier versions of the app, so it's not just an iOS 7
issue. Any advice on how to handle is appreciated. Many thanks.
No comments:
Post a Comment