按钮点击时按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 :(得分:0)
将[self.navigationController setNavigationBarHidden:FALSE]
放入viewDidLoad
(假设您已创建导航控制器)。