Ser*_*gor 5 iphone objective-c uinavigationbar uinavigationitem ios
我创建了自定义UINavigation Back Button.但是iOS 6和iOS 7中按钮的来源不同.
iOS 6外观:

iOS 7外观:

如何UINavigation Back Button在iOS 7 中将原点设置为与iOS 6中相同?
使用此代码修复左栏按钮位置:
//First add the following macro:
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
//Then customize your navigation bar:
- (void) initNavigationBar
{
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
negativeSpacer.width = -10;
}
else
{
negativeSpacer.width = 0;
}
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:_customBackButton];
self.navigationItem.leftBarButtonItems = @[negativeSpacer,backButton];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
285 次 |
| 最近记录: |