2012-01-23 114 views
1

在按鈕單擊時推動kalviewcontroller時導航欄丟失。如何添加導航欄?這樣它可以彈出來查看控制器在哪裏按下按鈕點擊。導航欄丟失

kal = [[[KalViewController alloc] init]autorelease]; 
kal.title = @"Calendar of game"; 

kal.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] 
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self 
action:@selector(addEvent)] autorelease]; 
kal.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" 
style:UIBarButtonItemStyleBordered target:self action:@selector(backToPrevious)] 
autorelease]; 

kal.delegate = self; 
dataSource = [self init]; 
kal.dataSource = dataSource; 
[self.navigationController pushViewController:kal animated:YES]; 

回答

0

[self.navigationController setNavigationBarHidden:FALSE]viewDidLoad(假設你已經創建導航控制器)。

+0

當你假設他已經創建了一個navigationController--所以你還假定他的navigationController隱藏了? - 你沒有提到這個假設...... – samfisher