Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发布应用程序Iphone肖像和Ipad景观_Iphone_Ios_Objective C_Ipad - Fatal编程技术网

发布应用程序Iphone肖像和Ipad景观

发布应用程序Iphone肖像和Ipad景观,iphone,ios,objective-c,ipad,Iphone,Ios,Objective C,Ipad,我有这个代码,我需要检测的是ipad发布应用程序场景还是iphone仅处于纵向模式 NSString *deviceType = [UIDevice currentDevice].model; if([deviceType isEqualToString:@"iPhone"]) { NSLog(@"This is iPhone"); } else { NSLog(@"This is iPad"); } 这

我有这个代码,我需要检测的是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;
}

iPodtouch呢?您应该使用
if(UI\u USER\u INTERFACE\u IDIOM()==UIUserInterfaceIdiomPad)