您的位置:首页 > 其它

自定义导航栏的返回按钮

2015-08-20 15:08 288 查看
/*
获取左侧导航栏按钮
*/
- (void)customBackItems{

UIButton *button = [UIButton
buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage
imageNamed:@"Left_arrow"]
forState:UIControlStateNormal];
[button addTarget:self
action:@selector(callModalList)
forControlEvents:UIControlEventTouchUpInside];
button.frame =
CGRectMake(5,
5, 36,
36);

UIBarButtonItem *leftButton = [[UIBarButtonItem
alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = leftButton;
}

/*
导航栏后退
*/
- (void)callModalList{
NSLog(@"点击了左侧按钮");
[self.navigationController
popViewControllerAnimated:YES];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: