I have created custom UINavigation Back Button
. But the origin of the button is different in iOS 6 and iOS 7.
iOS 6 look:
iOS 7 look:
How to set UINavigation Back Button
origin in iOS 7 to be the same like in iOS 6?
Use this code to fix left bar button position:
//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];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With