使用下面的代碼我正在實現我自己的導航欄。出於某種原因,當我運行我的應用程序時,導航欄上沒有顯示後退(左箭頭)按鈕。但是,如果我將代碼更改爲leftBarButtonItem,則按鈕確實會出現。UINavigationItem BackButtonItem not displayed
// Draw Navigation Bar
UINavigationBar *navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
[navigationBar setDelegate:self];
UINavigationItem *navigationItem = [[UINavigationItem alloc] init];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStylePlain
target:nil
action:nil];
navigationItem.backBarButtonItem = backButton;
[navigationBar pushNavigationItem:navigationItem animated:NO];
[self.view addSubview:navigationBar];
[navigationBar release];
[backButton release];
我明白了,一般像你說我會實現導航欄。然而,在這種情況下,我用程序創建了一個SplitView,這意味着我的SplitViewController是UINavigationController。我想要做的就是隱藏SplitView的NavigationBar併爲我的左側和右側ViewController構建獨特的NavigationBar –