UIBarButtonItem
导航栏左边 设置图片
#import "UIBarButtonItem+XMGExtension.h" @implementation UIBarButtonItem (XMGExtension) + (instancetype)itemWithImage:(NSString *)image highImage:(NSString *)highImage target:(id)target action:(SEL)action { UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted]; [button sizeToFit]; [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; return [[UIBarButtonItem alloc] initWithCustomView:button]; } @end