如何更改UINavigationControler上的后退按钮 [英] How do I change the back button on a UINavigationControler
本文介绍了如何更改UINavigationControler上的后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在视图中,我想更改它,因为我有以下代码,但失败了.
In the view I want to change it for I have the following code but it fails.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//Logout button
UIBarButtonItem * logout = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(goBack)];
logout.title = @"Logout";
nav_delegate.navigationController.navigationItem.leftBarButtonItem = logout;
[logout release];
}
谢谢您的帮助.
推荐答案
这就是答案.在视图控制器中:
Here's the answer. In the view controller:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"X";
//Logout button
UIBarButtonItem * logout = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style: UIBarButtonItemStylePlain target:self action:@selector(goBack)];
self.navigationItem.leftBarButtonItem = logout;
[logout release];
}
这篇关于如何更改UINavigationControler上的后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文