如何在其他类上处理navigationController

时间:2009-11-17 03:48:44

标签: iphone uinavigationcontroller

我有这样的课程

DrillDownAppAppDelegate.h PictureCell.h RootViewController.h SlideShowViewController.h

DrillDownAppAppDelegate.m PictureCell.m RootViewController.m SlideShowViewController.m

当我点击屏幕时,我想隐藏我的导航栏,在类SlideShowViewController中 但它不起作用 我的代码是

[self.navigationController setNavigationBarHidden:YES animated:YES];

1 个答案:

答案 0 :(得分:0)

假设RootViewController是UINavigationController堆栈上的可见视图控制器,只需按正常方式推送SlideShowViewController,但是在SlideShowViewController中,包含以下代码:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}