如何将 UINavigationBar 返回按钮的标题更改为“返回" [英] How to change the title of the UINavigationBar back button to "Back"

查看:76
本文介绍了如何将 UINavigationBar 返回按钮的标题更改为“返回"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将视图推到导航控制器上时,后退按钮的标题设置为上一个视图的标题.我怎样才能让后退按钮只说后退"?

When I push a view onto the navigation controller the back button's title get's set to the title of the previous view. How can I get the back button to just say "Back"?

推荐答案

在你的 viewwillappear 中写下这段代码:

Write this code in your viewwillappear:

UIBarButtonItem *_backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = _backButton;
[_backButton release];
_backButton = nil;

这篇关于如何将 UINavigationBar 返回按钮的标题更改为“返回"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆