如何在导航的背景图像和IOS 7中的文本之间添加一个空格。对于IOS 6,添加一个空格使文本位于正确的位置。
IOS 6的Navbar:

IOS 7的Navbar:

我在AppDelegate中重新定义所有后退按钮的代码:
// Change the appearance of other navigation button
UIImage *barButtonImage = [[UIImage imageNamed:@"icon_back_str.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 31, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:barButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
//Adapt the Text of the Buttons
NSDictionary *normalAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"MyFont" size:20.0], UITextAttributeFont,nil];
[[UIBarButtonItem appearance] setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];在我的代码中,设置文本:
- (void) viewWillDisappear:(BOOL)animated {
self.navigationItem.title = @" Zurück";
}如何在IOs 7中添加这个空间。谢谢。
发布于 2014-05-15 14:56:43
关于
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(5, 0) forBarMetrics:UIBarMetricsDefault];https://stackoverflow.com/questions/23681257
复制相似问题