iOS定制修改navigation的back按钮

时间:2014-10-30 13:31:53   收藏:0   阅读:353

iOS开发中,navigation的返回按钮是英文“back”,想修改成中文“返回”或者自定义的文字;这么简单的事情却折腾了小半个小时。原来是被leftBarButtonItem和rightBarButtonItem的设置方法给迷惑了。
我们设置leftBarButtonItem和rightBarButtonItem的时候都是在当前页面;而backBarButtonItem却是在父页面;所以需要在调用

 [self.navigationControllerpushViewController:photoController animated:YES];

之前执行;代码如下:

  self.navigationItem.backBarButtonItem=[[UIBarButtonItemallocinitWithTitle:@”返回style:UIBarButtonItemStyleBorderedtarget:nilaction:nil];

    [self.navigationControllerpushViewController:photoController animated:YES];

赶快试试吧!

原文:http://blog.csdn.net/wuwo333/article/details/40618143

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!