iOS開發中,navigation的返回按鈕是英文“back”,想修改成中文“返回”或自定義的文字;這么簡單的事情卻折騰了小半個小時。原來是被leftBarButtonItem和rightBarButtonItem的設置方法給迷惑了。
我們設置leftBarButtonItem和rightBarButtonItem的時候都是在當前頁面;而backBarButtonItem卻是在父頁面;所以需要在調用
[self.navigationControllerpushViewController:photoController animated:YES];
之前履行;代碼以下:
self.navigationItem.backBarButtonItem=[[UIBarButtonItemalloc] initWithTitle:@”返回“style:UIBarButtonItemStyleBorderedtarget:nilaction:nil];
[self.navigationControllerpushViewController:photoController animated:YES];
趕快試試吧!