IOS7 under the Uibarbuttonitem offset 10pt, I believe this is the effect that we do not want, the solution is to add a uibarbuttonsystemitemfixedspace item, But at 7.1 start, just add a fixedspaceitem run will hang off, swollen, compatible solution is to add an empty item in front, the code is as follows:
Uibarbuttonitem *item = [[uibarbuttonitem alloc] initwithcustomview: button]; Item to add to the Navgationbar
if ([uidevice iOS7]) {
uibarbuttonitem *plain = [[ Uibarbuttonitem alloc] initwithtitle: span class= "s2" >nil style: Uibarbuttonitemstyleplain target: nil action< Span class= "S1" >: null ]; //Resolve 7.1 hang-out issues
uibarbuttonitem *fix = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem :uibarbuttonsystemitemfixedspace target : nil action : NULL ];
Fix. width =-ten; Correcting offsets of 10pt
self. Navigationitem. Rightbarbuttonitems = @[plain,item,fix]; That's it, perfect!
} Else {
self. Navigationitem. Rightbarbuttonitem = Item;
}
This article is from the "idanal" blog, make sure to keep this source http://danal.blog.51cto.com/3353275/1565509
Solution to uibarbuttonitem Migration under IOS7