Update for iOS 9
I did some honest testing in a clean project with several dozen built-in fonts of different sizes, and I think I can confidently say that tag size issues found in earlier versions of iOS were fixed in (or before) iOS 9.
The use case described in the original question doesn't seem reproducible, and now the title bar seems to resize correctly. Thus, I do not consider it necessary to update the layout manually.
If you still see truncation problems when there is a lot of visual space available in the navigation bar, you can try a few things:
- Remove any additional views that you may have used to work around the problem. For example, if you create your own
UILabel and set it as the titleView navigation titleView , you can stop doing this and just set the title as usual. - Remove as much code as possible that adjusts the size of the navigation bar and
titleView . This includes the code found in the originally accepted answer below. - If you are using a custom font (i.e. not included in iOS), check it to make sure that it is not damaged and contains all the metadata necessary for iOS to measure them correctly. If the font is damaged, it may not display correctly when used.
Original answer
There are some known issues with the UINavigationBar layout. Try updating the layout when the view controller appears, and / or while rotating.
- (void)viewDidLoad { [super viewDidLoad]; ... [[[self navigationController] navigationBar] setNeedsLayout]; }
macserv
source share