iOS - 判断当前机型设备尺寸

iOS - 判断当前机型设备尺寸_第1张图片
机型尺寸

  NSString *CurrentDevice=[NSString stringWithFormat:@"%@",[[UIScreen mainScreen]preferredMode]];
    
    NSRange this=[CurrentDevice rangeOfString:@"2208"];
    if (this.location != NSNotFound) {
        
        NSLog(@"iPhone6 Plus");
        
    }else {
        
        this=[CurrentDevice rangeOfString:@"1334"];
        if (this.location != NSNotFound) {
            
            NSLog(@"iPhone6.6s");
            
        }else {
            
            this=[CurrentDevice rangeOfString:@"1136"];

            if (this.location != NSNotFound) {
                
                NSLog(@"iphone5/5s");
                
            }else {
                this=[CurrentDevice rangeOfString:@"960"];
                
                if (this.location != NSNotFound) {
                    NSLog(@"iphone4/4s");
                    
                }else {
                    NSLog(@"其他");
                }
            }
        }

你可能感兴趣的