iOS设备判断

来源:互联网 发布:室内设计建模软件 编辑:程序博客网 时间:2024/05/16 01:03

    //当前设备类型判别

    NSInteger device = [UIDevicecurrentDevice].userInterfaceIdiom;

    switch (device) {

        case UIUserInterfaceIdiomUnspecified :

            NSLog(@"未知设备");

            break;

        case UIUserInterfaceIdiomPhone :

            NSLog(@"iPhone and iPod Touch设备");

            break;

        case UIUserInterfaceIdiomPad :

            NSLog(@"iPad");

            break;

        case UIUserInterfaceIdiomTV :

            NSLog(@"Apple TV");

            break;

        case UIUserInterfaceIdiomCarPlay :

            NSLog(@"CarPlay");//CarPlay是美国苹果公司发布的车载系统,它将用户的iOS设备、iOS使用体验与仪表盘系统无缝结合。

            break;

        default:

            break;

    }


1 0