使读卡器应用程序全屏?
问题描述:
你好,我有一个应用程序与视图控制器,我显示一些文本 - 它也有一个工具栏和导航栏。使读卡器应用程序全屏?
我想要当我按下按钮来隐藏导航栏和工具栏也状态栏,并使文本视图去全屏,如果用户点击视图的导航栏和工具栏来显示。
那么我该怎么做?我试图玩视图的框架属性,没有成功。
编辑这里是我的代码现在。我的问题只有1 - 状态栏没有填充 - 这只是一个黑色的东西。
- (IBAction)goFullScreen:(id)sender {
self.isFullScreenOn = !self.isFullScreenOn;
if (self.isFullScreenOn) {
self.navigationController.navigationBarHidden = NO;
self.toolbar.hidden = NO;
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
self.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}else{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
self.navigationController.navigationBarHidden = YES;
self.toolbar.hidden = YES;
self.view.frame = CGRectMake(0, -60, self.view.frame.size.width, self.view.frame.size.height + 60);
}
}
答
开始让酒吧内不隐藏
self.currentView.toolBar.hidden=NO;
我们使它看起来和一个水龙头消失在屏幕上,在视图 - 控制添加tapgesture识别
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired=1;
[self.currentView addGestureRecognizer:tapGesture];
[tapGesture release];
现在定义handleTapGesture功能
-(void) handleTapGesture:(UITapGestureRecognizer *)sender {
if(self.currentView.toolBar.alpha==1.0){
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.8];
self.currentView.toolBar.alpha = 0.0;
//similarly add other properties to be hidden like label,button etc
[UIView commitAnimations];
}
else{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.8];
self.currentView.toolBar.alpha = 1.0;
[UIView commitAnimations];
}
}
答
设置你的导航栏和工具栏的hidden
属性YES
。
答
您可以用presentModalViewController显示一个新的Viewcontroller。 你可以简单地解雇它,不必做任何rezising。
答
要隐藏导航栏: -
self.navigationController.navigationBarHidden = YES ;
要隐藏状态栏: -
[[UIApplication sharedApplication] setStatusBarHidden:YES];
设置hidden
工具栏的属性
答
试试这个
[[UIApplication sharedApplication] setStatusBarHidden: YES withAnimation: UIStatusBarAnimationFade];
[self.navigationController setNavigationBarHidden:YES animated:YES];
仍然状态栏只是一个黑色的矩形 – DevFly 2012-08-14 10:03:57
它应该是autore当您在代码上方执行代码时,请尝试删除您的代码。 – iNeal 2012-08-14 10:07:26
仍然一样。 – DevFly 2012-08-14 10:12:49