所以我有一個帶有表格視圖的根視圖。我顯示工具欄是這樣的:無法將按鈕添加到表格視圖工具欄
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.navigationController.toolbarHidden = NO;
}
我實現setToolbarItems方法:
- (void)setToolbarItems:(NSArray *)toolbarItems animated:(BOOL)animated
{
UIBarButtonItem *buttonItem;
buttonItem = [[UIBarButtonItem alloc] initWithTitle:@"Hello" style:UIBarButtonItemStyleDone target:self action:@selector(goBack:)];
self.navigationController.toolbarItems = [ NSArray arrayWithObject: buttonItem ];
}
的結果是一個空tolbar。爲什麼?
拋出EX_BAD_ACCESS異常... – 2012-04-08 16:29:55
它停止了什麼行? – CodaFi 2012-04-08 17:11:25
對不起,它的工作原理:) – 2012-04-08 17:30:31