美文网首页
iOS - 判断当前机型设备尺寸

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

作者: 骑行怪状 | 来源:发表于2016-08-27 16:39 被阅读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(@"其他");
                }
            }
        }

相关文章

网友评论

      本文标题:iOS - 判断当前机型设备尺寸

      本文链接:https://www.haomeiwen.com/subject/imhtettx.html