我從NavigationViewController模板啓動了我的xcode項目。現在,當我推送一個視圖時,該視圖會默認出現一個編輯按鈕,並且沒有後退按鈕。我已經註釋掉editButton代碼和相應的setEditing委託方法。但我無法獲得後退按鈕。我究竟做錯了什麼?backBarButtonItem在導航控制器中未顯示
推新觀點:在我PlaylistViewController
PlaylistViewController *playlistViewController = [[PlaylistViewController alloc] init];
playlistViewController.managedObjectContext = self.managedObjectContext;
[self.navigationController pushViewController:playlistViewController animated:YES];
[playlistViewController release];
:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"";
// self.navigationItem.leftBarButtonItem = self.editButtonItem;
// doesn't matter if this is here or not
self.navigationItem.hidesBackButton = false;
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)];
self.navigationItem.rightBarButtonItem = addButton;
[addButton release];
}
我無法知道爲什麼會出現這種情況。所以我從Interface Builder中刪除了導航控制器,並用代碼手動創建它。一切都如預期般運作。 – vesselhead