// // UIBarButtonItem+PBCategory.m // ProBIM // // Created by zjf on 2017/10/12. // Copyright © 2017年 ProBIM. All rights reserved. // #import "UIBarButtonItem+PBCategory.h" @implementation UIBarButtonItem (PBCategory) + (instancetype)barBuutonItemWithTarget:(id)target action:(SEL)action icon:(NSString *)icon highlighticon:(NSString *)highlighticon { UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:icon] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:highlighticon] forState:UIControlStateHighlighted]; //设置图像的大小 button.size = CGSizeMake(60, 30); [button addTarget:target action:action forControlEvents: UIControlEventTouchUpInside]; return [[UIBarButtonItem alloc] initWithCustomView:button]; } @end