Move a UIButton (like a UIBarButtonItem) in a UINavigationBar
Change position of a UIButton (like a UIBarButtonItem) in a UINavigationBar is simple. So, you can change the margin of the navigationItem button, using the imageEdgeInsets property. Be carefull... margin values are different in iOS6 and iOS7.
float v = [[[UIDevice currentDevice] systemVersion] floatValue]; if(v>=7) { //for iOS7 UIButton *btnLeft = (UIButton *)self.navigationItem.leftBarButtonItem.customView; btnLeft.imageEdgeInsets = UIEdgeInsetsMake(0, -16, 0, 16); } else { //for iOS6 UIButton *btnLeft = (UIButton *)self.navigationItem.leftBarButtonItem.customView; btnLeft.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 5); }
That's all!












