码迷,mamicode.com
首页 > 其他好文 > 详细

prefix.pch文件的一些简单使用

时间:2015-03-12 16:37:59      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:

该文件可以引入一些全局通用的文件,这样就不用每次在文件中导入,也可以定义全局通用的变量或常量,如

//定义NSString常量
#define     ServiceName     @"cn.zmfc"
//定义颜色
#define BackgroudColor  [UIColor colorWithRed:232/255.0 green:235/255.0 blue:240/255.0 alpha:1.0]
//定义IOS系统版本等
#define   currentVersion        [[UIDevice currentDevice].systemVersion floatValue]
#define   isIOS8        (currentVersion >= 8.0)
#define   isIOS7        (!isIOS8 && currentVersion >= 7.0)
#define   isIOS6        (currentVersion <= 6.0)
//定义数组
#define  ScatterArray   @[@"mega",@"medium",@"small",@"person",@"other"];

如对于判断版本问题,可直接使用。如

if(isIOS8){
    //要做的事
}

 

prefix.pch文件的一些简单使用

标签:

原文地址:http://www.cnblogs.com/Apologize/p/4332545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!