首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

荧屏是横向的时候,NavigationBar总是在下边

2013-09-08 
屏幕是横向的时候,NavigationBar总是在下边?-(void)rotateToInterfaceOrientation:(UIInterfaceOrientatio

屏幕是横向的时候,NavigationBar总是在下边?
-(void)rotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ switch(toInterfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: self.view.transform=CGAffineTransformMakeRotation(3.1415926*(-90));//向右旋转,顺时针旋转,弧度=度数/180*PI if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad { self.view.bounds=CGRectMake(0.0, 0.0, 1024.0, 748.0);//重点是这句话,标明视图位置,不然NavigationBar就可能在下边 [self loadHorizontalViewForIPad];//加载iPad水平视图 } else { self.view.bounds=CGRectMake(0.0, 0.0, 480.0, 300.0); [self loadHorizontalViewForIPhone];//加载iPhone水平视图 } break; case UIInterfaceOrientationLandscapeRight: self.view.transform=CGAffineTransformMakeRotation(3.1415926*90);//向左旋转,逆时针旋转弧度=度数/180*PI if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad { self.view.bounds=CGRectMake(0.0, 0.0, 1024.0, 748.0); [self loadHorizontalViewForIPad];//加载iPad垂直视图 } else { self.view.bounds=CGRectMake(0.0, 0.0, 480.0, 300.0); [self loadHorizontalViewForIPhone];//加载iPhone垂直视图 } break; default: self.view.transform=CGAffineTransformMakeRotation(0); if([self.deviceType isEqualToString:@"iPad Simulator"])//真机测试时换成 iPad { self.view.bounds=CGRectMake(0.0, 0.0, 768.0, 1004.0); [self loadVerticalViewForIPad]; } else { self.view.bounds=CGRectMake(0.0, 0.0, 320.0, 460.0); [self loadVerticalViewForIPhone]; } }}

?

?

热点排行