- (void)createNavigationLeftBarButtonItemWithCustomView:(UIButton *)button
{
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
if ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=7) {
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
negativeSpacer.width = -16;
self.navigationItem.leftBarButtonItems = @[negativeSpacer, buttonItem];
}else{
self.navigationItem.leftBarButtonItem = buttonItem;
}
}
其实测试了下左侧的item里旁边应该是16px,右侧是12px,可以去试试噢!
http://www.tuicool.com/articles/3Ufema
网友评论