The Barbuttonitem of the custom navigation bar under iOS will have some offset problems,
Solution: Adjust your item by creating a new system with a fixed-distance item
#defineIos7_navi_space-10} [Self.navigationitem setleftbarbuttonitems:[self getbackbarbuttonitem];}//Back button-(Nsarray *) getbackbarbuttonitem{//Custom ButtonUIButton *button=[[uibutton Alloc] Initwithframe:cgrectmake (0,0, -, *)]; //set a background picture[Button Setbackgroundimage:[uiimage imagenamed:@"Nav_left_btn_unselected.png"] Forstate:uicontrolstatenormal]; //Set Text[Button Settitle:@"return"Forstate:uicontrolstatenormal]; Button.titleLabel.font=[uifont systemfontofsize: -]; //Set Text color[button Settintcolor:[uicolor Whitecolor]; //add behavior for Touchupinside[button addtarget:self action: @selector (Backaction) forcontrolevents:uicontroleventtouchupinside]; //Initialize a barbuttonitemUibarbuttonitem *item=[[Uibarbuttonitem alloc] Initwithcustomview:button]; //a barbuttonitem placeholder with a fixed distance in the initialization of a systemUibarbuttonitem *fixedspace=[[Uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemfixedspace target:self Action:nil]; Fixedspace.width=ios7_navi_space;//Set width
Put the item with a fixed distance in front and adjust the distancereturn[[Nsarray alloc] initwithobjects:fixedspace,item, nil];}
IOS7 some problems with custom Uibarbuttonitem