There may be a better way, but to fix interpolation issues on button bar items on iOS 7, I subclassed the UINavigationBar and redefined the layoutSubviews method. There you can move every element of the panel button wherever you want.
As an example:
- (void)layoutSubviews { [super layoutSubviews]; // If iOS 7, fix the bar button positions BOOL isIOS7 = [[[UIDevice currentDevice] systemVersion] compare:@"7" options:NSNumericSearch] != NSOrderedAscending; if (isIOS7) { for (UIBarButtonItem *item in self.topItem.leftBarButtonItems) { // Reposition the customView property } for (UIBarButtonItem *item in self.topItem.rightBarButtonItems) { // Reposition the customView property } } }
Actually, when I looked at my code, I used UIBarButtonItems with custom views. Thus, I was able to move the user position of the view.
You will most likely have to iterate over the subviews of the UINavigationBar to move them if you just use UIBarButtonItems with these images:
- (void)layoutSubviews { [super layoutSubviews]; // If iOS 7, fix the bar button positions BOOL isIOS7 = [[[UIDevice currentDevice] systemVersion] compare:@"7" options:NSNumericSearch] != NSOrderedAscending; if (isIOS7) { for (UIView *subview in self.subviews) { // Reposition as needed } } }
Ben baron
source share