向UINavigationBar(iPhone)添加左键 [英] Adding left button to UINavigationBar (iPhone)
本文介绍了向UINavigationBar(iPhone)添加左键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个新的基于导航的iPhone应用程序。我将它添加到RootViewController。
I've created a new navigation based iPhone app. I added this to the RootViewController.
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] init];
self.navigationItem.leftBarButtonItem = addButton;
self.navigationItem.leftBarButtonItem.enabled = YES;
}
但是不显示左按钮。有什么我需要做的吗?
No left button displays however. Is there something I need to do?
推荐答案
你没有定义按钮的实际功能。这是我的应用程序中的一行:
You don't define what the button actually does. This is a line from my app:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelEdit:)];
cancelEdit:
,选择器,在当前类(self)并定义为:
cancel
, the selector, is in the current class (self) and is defined as:
- (void) cancelEdit: (id) sender;
这篇关于向UINavigationBar(iPhone)添加左键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文