1

我有这个代码,我需要检测是 ipad 启动应用程序横向还是 iPhone 在纵向模式下

    NSString *deviceType = [UIDevice currentDevice].model;

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

1 回答 1

-1

这行得通!!!IOS 6

-(NSUInteger)supportedInterfaceOrientations{

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

        return UIInterfaceOrientationMaskPortrait;
    else
        return UIInterfaceOrientationMaskLandscape;
}

- (BOOL)shouldAutorotate {
    return YES;
}
于 2013-09-12T21:41:06.623 回答