iOS ios5 以下的横屏代码

来源:互联网 发布:syslog centos 编辑:程序博客网 时间:2024/04/28 20:10

ios5的系统不能直接在xxx.plist文件里面设置横屏 需要在页面添加以下两个方法

(

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

这个 [selfpresentViewController:vc animated:YEScompletion:nil];

来跳转的话又要在第一个页面添加那两段话

)

-(NSUInteger)supportedInterfaceOrientations{     //UIInterfaceOrientationMaskLandscape、UIInterfaceOrientationMaskAll、UIInterfaceOrientationMaskAllButUpsideDown  //UIInterfaceOrientationMaskLandscape    return UIInterfaceOrientationMaskLandscape;    }//考虑到兼容低版本,最好加上: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {     if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation == UIInterfaceOrientationLandscapeRight)     {         return YES;     }     else     {         return NO;     } }  //上面改UIInterfaceOrientationLandscapeLeft