Iphone在通用应用程序中的固定方向 [英] Fixed orientation for Iphone in universal app
问题描述
我已经开发了一个通用应用程序,我想支持IPAD的所有方向,但是对于Iphone,我只希望UIInterfaceOrientationPortrait和UIInterfaceOrientationPortraitUpsideDown可以做到这一点
I have developed a universal app I want to support all orientation for IPAD but for Iphone I just want UIInterfaceOrientationPortrait and UIInterfaceOrientationPortraitUpsideDown only for this I have
-(BOOL)shouldAutorotate {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return NO;
}else{
return YES;
}
}
- (NSUInteger)supportedInterfaceOrientations{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return UIInterfaceOrientationMaskPortrait;
}else{
return UIInterfaceOrientationMaskAll;
}
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ;
}else{
return YES;
}
}
但是仍然不能停止横向定向
But still is not stop the orientation in landscape
推荐答案
仅从摘要中为 iPhone 禁用除UIInterfaceOrientationPortrait
和UIInterfaceOrientationPortraitUpsideDown
以外的所有其他方向. strong>就像下面的描述一样. 在照片中,颠倒"已禁用,请启用它.谢谢.
Simply disable all other orientations except the UIInterfaceOrientationPortrait
and UIInterfaceOrientationPortraitUpsideDown
one for the iPhone from the Summary like in the description below. In the pic the Upside down is disabled please enable it. Thanks.
这篇关于Iphone在通用应用程序中的固定方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!