标签:io ar os sp for strong on cti bs
// 自定义导航栏"返回按钮"
- (void)initNaviBackBtn
{
UIButton *backBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];
backBtn.frame = CGRectMake(0, 0, 50, 22);
[backBtn setImage:[UIImageimageNamed:@"backBtn"] forState:UIControlStateNormal];
[backBtn addTarget:selfaction:@selector(back) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backItem = [[UIBarButtonItemalloc] initWithCustomView:backBtn];
// 控制按钮的左右间距
UIBarButtonItem *negativeSpacer = [[UIBarButtonItemalloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nilaction:nil];
if (IOS_VERSION_6) {
negativeSpacer.width = 2;
} else {
negativeSpacer.width = -9;
}
self.navigationItem.leftBarButtonItems = [NSArrayarrayWithObjects:negativeSpacer, backItem, nil];
// self.navigationItem.leftBarButtonItem = backItem;
}
自定义导航栏按钮 baseViewController中写!
标签:io ar os sp for strong on cti bs
原文地址:http://www.cnblogs.com/liman1990/p/4122683.html