繁体   English   中英

启动应用程序Iphone纵向和Ipad横向

[英]Launch app Iphone portrait, and Ipad landscape

我有此代码,我需要检测的是ipad启动应用程序横向还是仅纵向模式下的iphone

    NSString *deviceType = [UIDevice currentDevice].model;

    if([deviceType isEqualToString:@"iPhone"])
    {
        NSLog(@"This is iPhone");
    }
    else
    {
        NSLog(@"This is iPad");
    }

这有效!!! 对于IOS 6

-(NSUInteger)supportedInterfaceOrientations{

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)

        return UIInterfaceOrientationMaskPortrait;
    else
        return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate {
    return YES;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM