标签:io ar sp for on bs cti ad tt
#import "UIBarButtonItem+Extension.h"
@implementation UIBarButtonItem (Extension)
+(UIBarButtonItem *)itemWithImageName:(NSString *)ImageName highImageName:(NSString *)highImageName target:(id)target action:(SEL)action{
UIButton *btn=[[UIButton alloc] init];
[btn setBackgroundImage:[UIImage imageNamed:ImageName] forState:UIControlStateNormal];
[btn setBackgroundImage:[UIImage imageNamed:highImageName] forState:UIControlStateHighlighted];
btn.frame=CGRectMake(0, 0, btn.currentBackgroundImage.size.width, btn.currentBackgroundImage.size.height);
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
return [[UIBarButtonItem alloc]initWithCustomView:btn];
}
@end
标签:io ar sp for on bs cti ad tt
原文地址:http://www.cnblogs.com/zhibin/p/4156656.html