UINavigationBar标题的问题

大家好,我用下面的代码自定义UINavigationBa标题之后,标题和文本都缩短了。

[[UINavigationBar appearance] setTitleTextAttributes:@{
                            UITextAttributeTextColor : [UIColor whiteColor],
                            UITextAttributeFont : [UIFont fontWithName:@"Intro" size:20.0f],
                            UITextAttributeTextShadowColor : [UIColor clearColor]
                            }];

CSDN移动问答

如图所示,其实空间长度足够完全显示的。

UINavigationBar 布局中有这样的问题。在视图控制器出现的时候更新一下布局

- (void)viewDidLoad
{
    [super viewDidLoad];
    ...
    [[[self navigationController] navigationBar] setNeedsLayout];
}