IOS - 后退按钮IOS6与IOS7

Lor*_*ohn 1 objective-c ios

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

来自IOS 6的Navbar:

来自IOS 6的Navbar:

来自IOS 7的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];
Run Code Online (Sandbox Code Playgroud)

在我的代码中,设置文本:

- (void) viewWillDisappear:(BOOL)animated {
self.navigationItem.title =  @" Zurück";
}
Run Code Online (Sandbox Code Playgroud)

如何在IO中添加此空间7.谢谢.

Sno*_*man 6

关于什么

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(5, 0) forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)