在iphone的照片库中,显示照片列表中,导航栏可以自动显示和隐藏。许多应用中也用到了导航栏中的隐藏和显示,实现效果如下图:

image

点击页面,导航栏隐藏:

image

下面是具体的实现过程。

首先创建工程,iphone.navta.

然后打开MainWindow.xib

添加UINavigationController。

 

image 

进行关联。

在具体需要隐藏和显示导航栏的controller中实现:

#pragma mark – 
#pragma mark onClick 
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 

      isflage=!isflage; 
    [super.navigationController setNavigationBarHidden:isflage animated:TRUE]; 
    [super.navigationController setToolbarHidden:isflage animated:TRUE]; 
}