启动应用程序Iphone肖像和Ipad风景

时间:2013-09-12 21:02:31

标签: 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");
    }

1 个答案:

答案 0 :(得分:-1)

这个有效!!!对于IOS 6

-(NSUInteger)supportedInterfaceOrientations{

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

        return UIInterfaceOrientationMaskPortrait;
    else
        return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate {
    return YES;
}