美文网首页
修改nav返回按钮样式,并且设施返回按钮点击事件

修改nav返回按钮样式,并且设施返回按钮点击事件

作者: 恋家的人走不丢 | 来源:发表于2017-12-06 17:48 被阅读0次

#pragma mark返回文字置空

- (void)viewWillAppear:(BOOL)animated

{

[superviewWillAppear:animated];

self.navigationController.navigationBar.barTintColor=customColor(42,45,58);

self.navigationController.navigationBar.hidden=NO;

UIButton* button = [UIButtonbuttonWithType:UIButtonTypeCustom];

button.frame=CGRectMake(0,5,25,25);

[buttonsetImage:[UIImageimageNamed:@"nav_icon"]forState:UIControlStateNormal];

[buttonaddTarget:selfaction:@selector(buttonClick)forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem* buttonItem = [[UIBarButtonItemalloc]initWithCustomView:button];

self.navigationItem.leftBarButtonItem= buttonItem;

}

- (void)buttonClick

{

[self.navigationControllerpopViewControllerAnimated:YES];

self.navigationController.navigationBar.alpha=1;

}

相关文章

网友评论

      本文标题:修改nav返回按钮样式,并且设施返回按钮点击事件

      本文链接:https://www.haomeiwen.com/subject/daelixtx.html