如何更改后退按钮上的文本 [英] How to change text on a back button

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

问题描述

默认情况下,后退按钮使用作为文本的视图控制器的标题。
我可以在后台按钮上更改文本而不改变视图控制器的标题?
我需要这是因为我有一个视图控制器的标题太长,显示,在这种情况下,我想显示只是返回作为标题的后退按钮。

By default the back button uses as a text on it a title of a viewcontroller. Can I change text on the back button without changing a title of a view controller? I need this because I have a view controller which title is too long to display and in this case I would like to display just "Back" as a caption for back button.

我尝试了下列方法无效:

I tried the following which didn't work:

self.navigationItem.leftBarButtonItem.title = @"Back";

谢谢。

推荐答案

尝试

self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease];



我发现通过查看Apple的文档中的backBarButtonItem文档 UINavigationController

这篇关于如何更改后退按钮上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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