遇到这种情况,知道怎么ios 横屏导航栏尺寸,可怎么把那显示栏退掉??

如何判断当前屏幕是横屏还是竖屏 | iOS开发讨论区
我的图书馆
如何判断当前屏幕是横屏还是竖屏 | iOS开发讨论区
判断ipad横竖屏的两个方法方法一[[UIScreenmainScreen] applicationFrame].size.height[[UIScreenmainScreen] applicationFrame].size.width可以用来获取当前屏幕的尺寸,高和宽。由于系统的状态条占高20且总是在屏幕上方,它使得上面两个值在横竖屏的时候有变化,因此可用来判断当前是横屏还是竖屏。简单的说竖屏时,height为1004,width为768。横屏时,height为1024,width为748。当然 ,前提是你没有把系统的状态栏去掉.它可以用在任何方法内作为判断条件.应用示例如下:if (loadingview ==nil) {loadingview = [[UIViewalloc] initWithFrame:CGRectMake(284, 402, 200, 200)];if ([[UIScreenmainScreen] applicationFrame].size.height==1024) { loadingview.frame=CGRectMake(412, 264, 200, 200);//此时为横屏}[loadingviewsetBackgroundColor:[UIColorclearColor]];//创建loadingview的时候根据当前横竖屏设定位置。方法二在论坛里已经有人发过了 呵呵//下面则是直接以屏幕方向判断- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {switch (interfaceOrientation) {&&&&&&&&caseUIInterfaceOrientationPortrait://home健在下loadingview.frame=CGRectMake(284, 402, 200, 200);[self.viewaddSubview:loadingview];&&&&&&&&caseUIInterfaceOrientationPortraitUpsideDown://home健在上loadingview.frame=CGRectMake(284, 402, 200, 200);[self.viewaddSubview:loadingview];&&&&&&&&caseUIInterfaceOrientationLandscapeLeft://home健在左loadingview.frame=CGRectMake(412, 264, 200, 200);[self.viewaddSubview:loadingview];&&&&&&&&caseUIInterfaceOrientationLandscapeRight://home健在右loadingview.frame=CGRectMake(412, 264, 200, 200);[self.viewaddSubview:loadingview];&&&&&&&&default:&&&&&&&&&&&&}}- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration这些都可以知道当前的屏幕状态的[ 此帖被zzxap在 16:56重新编辑 ]
TA的最新馆藏
喜欢该文的人也喜欢}

我要回帖

更多关于 ios横屏隐藏状态栏 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信