美文网首页
定制导航栏返回按钮

定制导航栏返回按钮

作者: 刘振杰 | 来源:发表于2016-08-18 11:13 被阅读11次

-(void) createLeftButton{

[self.navigationItemsetHidesBackButton:YES];

UIButton*btn = [UIButtonbuttonWithType:UIButtonTypeCustom];

btn.frame=CGRectMake(10, 5, 20, 18);

[btnsetBackgroundImage:[UIImageimageNamed:@"back-arrow.png"]forState:UIControlStateNormal];

[btnaddTarget:selfaction:@selector(goBackAction)forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem*back=[[UIBarButtonItemalloc]initWithCustomView:btn];

self.navigationItem.leftBarButtonItem=back;

}

-(void)goBackAction{

[self.navigationControllerpopViewControllerAnimated:YES];

}

相关文章

网友评论

      本文标题:定制导航栏返回按钮

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