您的位置:首页 > 移动开发 > IOS开发

iOS ios5 以下的横屏代码

2013-10-08 13:58 281 查看
ios5的系统不能直接在xxx.plist文件里面设置横屏 需要在页面添加以下两个方法

(

 [self
presentViewController:vc animated:YES
completion:nil];跳到那个页面添加那两段  之后在那个页面的 add 和 remove 都不要再添加了 但是如果又有新的用

这个 [self
presentViewController:vc animated:YES
completion:nil];
来跳转的话又要在第一个页面添加那两段话

)

-(NSUInteger)supportedInterfaceOrientations{
//UIInterfaceOrientationMaskLandscape、UIInterfaceOrientationMaskAll、UIInterfaceOrientationMaskAllButUpsideDown  //UIInterfaceOrientationMaskLandscape
return UIInterfaceOrientationMaskLandscape;

}

//考虑到兼容低版本,最好加上:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
return YES;
}
else
{
return NO;
}
}  //上面改UIInterfaceOrientationLandscapeLeft
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: