导航栏丢失了

时间:2012-01-23 09:49:48

标签: iphone ios

按钮点击时按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];

1 个答案:

答案 0 :(得分:0)

[self.navigationController setNavigationBarHidden:FALSE]放入viewDidLoad(假设您已创建导航控制器)。