设为首页 加入收藏

TOP

【代码笔记】iOS-判断是否是iPhone5
2017-10-13 10:29:04 】 浏览:7456
Tags:代码 笔记 iOS- 判断 是否是 iPhone5

一,代码。

复制代码
#import "RootViewController.h"


// 判断是否是iPhone5
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)]\
? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)\
|| CGSizeEqualToSize(CGSizeMake(1136, 640), [[UIScreen mainScreen] currentMode].size) : NO)



@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    self.title=@"isIphone5";
    
    //判断是否为iPhone5
    NSLog(@"---isIphone5---%i",iPhone5);
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
复制代码

 

二,输出。

2015-10-19 15:32:46.917 判断是否是iPhone5[9128:228174] ---isIphone5---1

 

 

 
 
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇电工助手 V1.4 下一篇RunTime&RunLoop初见

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目