UIBarButtonItem 位置问题

2018-06-13 16:42:22 浏览数 (1)

1. UIEdgeInsetsMake方式
代码语言:javascript复制
NSInteger inset = App_Frame_Width == 414 ? 10:6;
self.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(0,-inset,0,inset);

2.填充方式

代码语言:javascript复制
UIBarButtonItem *fixedSpaceBarButtonItem = [[UIBarButtonItem 
alloc] 
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace 
target:nil action:nil];
self.navigationItem.leftBarButtonItems = @[fixedSpaceBarButtonItem,backBtnItem];

0 人点赞