2013-06-05 194 views

回答

1

将点按手势添加到视图

UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideUIComponents:)]; 
[self.view addGestureRecognizer:tapGestureRecognizer]; 

然后函数hideUIComponents

- (void)hideUIComponents:(UITapGestureRecognizer*)tapGesture 
{ 
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; 
    [[self navigationController] setNavigationBarHidden:YES animated:YES]; 

    CATransition *animation = [CATransition animation]; 
    [animation setType:kCATransitionMoveIn]; 
    [[self.view.window layer] addAnimation:animation forKey:@"layerAnimation"]; 
    [self.tabBarController.tabBar setHidden:YES]; 
} 

取消隐藏通过反转值。我希望这有帮助。

+0

CATransition是我的项目的未声明标识符,为什么? 你是什么意思通过颠倒值? – Delete

+0

@JoakimJojoElgsæther将QuartzCore.framework包含到您的项目中,并为CATransition包含#import 。相反,我的意思是将setHidden值更改为NO :) – Adithya

+0

@JoakimJojoElgsæther所有这些都在.m文件中 – Adithya

-1

你想这样做的叩击手势 然后就认为要实现使用

[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(ViewTapped:)] 

检查状态栏是否隐藏或不使用

[[UIApplication sharedApplication] isStatusBarHidden]; 

然后 要隐藏状态栏的使用:

[[UIApplication sharedApplication] setStatusBarHidden:YES]; 

,并再次显示它使用:

[[UIApplication sharedApplication] setStatusBarHidden:NO]; 
+0

谢谢!你可以给我.h代码和.m代码吗?我是一个非常新手所以... – Delete