Objective c 如何使导航栏中的文本垂直居中

Objective c 如何使导航栏中的文本垂直居中,objective-c,uitabbar,xcode4.5,Objective C,Uitabbar,Xcode4.5,我这样做: [[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeTextColor: navTextColor,UITextAttributeTextShadowColor: navTextColor,UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],UITextAttributeFont: [UIF

我这样做:

[[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeTextColor: navTextColor,UITextAttributeTextShadowColor: navTextColor,UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],UITextAttributeFont: [UIFont fontWithName:@"HelveticaNeue-Bold" size:12],UITextAttributeFont: [UIFont fontWithName:@"HelveticaNeue-Bold" size:12]}];
结果是文本变小了。然而,它贴得太高了

我可以使用

[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:5 forBarMetrics:UIBarMetricsDefault];
但有时我想使用UIText,而不仅仅是标题视图上的图片,而这些图片也会被向下推

这将是一个非常奇怪的设计,我认为有文字向上这样。那么,问题是什么?我如何使UINavigationBar中的标题文本垂直居中,就像水平居中一样。

一个解决方案是检查

另一种解决方案是设置
标签视图的
框架
。检查