首页 > 其他 > 详细

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

时间:2015-03-12 16:37:47      阅读:119      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!