如何在IOS 7中的导航背景图像和文本之间添加空格。对于IOS 6,添加空格可使文本位于正确的位置。
IOS 6中的导航栏:
IOS 7中的导航栏:
我在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";
}
如何在IO 7中添加此空间。
最佳答案
关于什么
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(5, 0) forBarMetrics:UIBarMetricsDefault];
关于ios - iOS-后退按钮IOS6 vs IOS7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23681257/