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

2016-08-27  本文已影响153人  骑行怪状
机型尺寸

  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(@"其他");
                }
            }
        }

上一篇下一篇

猜你喜欢

热点阅读