pch文件使用

2018-01-05  本文已影响0人  买买提不撸串

一、配置

1、首先配置pch文件

图1

2、然后在Build Settings中找到如图

图2 

3、command+B编译一下就可以了

 二、使用

在pch文件中可以添加一些宏,例如屏幕宽高、和一些在其他文件需要引入头文件的头文件,不易在pch文件中定义过多宏,这样会增加预编译时间

#ifndef PrefixHeader_pch

#define PrefixHeader_pch

#define SCREEN_FRAME ([UIScreen mainScreen].applicationFrame)

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)

#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

#import "NSString+kk_Str.h"

#endif

上一篇 下一篇

猜你喜欢

热点阅读