iOS定制改动navigation的backbutton

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

 [self.navigationControllerpushViewController:photoController animated:YES];

之前运行;代码例如以下:

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

    [self.navigationControllerpushViewController:photoController animated:YES];

赶快试试吧!

原文地址:https://www.cnblogs.com/claireyuancy/p/6963180.html