UINavigationController点击View隐藏与显示

来源:互联网 发布:远程操控苹果电脑软件 编辑:程序博客网 时间:2024/05/16 15:45
@interface ViewController ()  
    {  
        BOOLisflage;  
    }  
    @end  
        
    @implementation ViewController  
        
    - (void)viewDidLoad  
    {  
        [super viewDidLoad];  
        // Do any additional setup after loading the view from its nib.          isflage = YES;  
        [self.navigationController setNavigationBarHidden:isflage animated:YES];  
        
    }  
          #pragma mark onClick         
    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event  
    {  
        isflage = !isflage;  
        [self.navigationController setNavigationBarHidden:isflage animated:YES];  
    }  
        
    @end
<P>
上述代码的实现结果就是:
</P>
  
<P>
先隐藏navigationController,之后点击会显示,再点击又会隐藏,超简单吧。
</P>
  
<P>
同样tabBarController也是同样的实现结果。
</P>
0 0