配置PCH文件及常用宏

配置PCH文件路径

$(SRCROOT)/$(PRODUCT_NAME)/PrefixHeader.pch


PCH文件


#ifdef __OBJC__

//导入头文件


//宏定义
/**获取系统对象*/
#define kApplication [UIApplication sharedApplication]

#define kAppWindow [UIApplication sharedApplication].delegate.window

#define kAppDelegate [AppDelegate shareAppDelegate]

#define kRootViewController [UIApplication sharedApplication].delegate.window.rootViewController

#define kUserDefaults [NSUserDefaults standardUserDefaults]

#define kNotificationCenter [NSNotificationCenter defaultCenter]

/**iphone6的*/
#define Iphone6ScaleWidth KScreenWidth/375.0
#define Iphone6ScaleHeight KScreenHeight/667.0

/**根据ip6的屏幕来拉伸*/
#define kRealValue(with) ((with)*(KScreenWidth/375.0f))

/**强弱引用*/
#define kWeakSelf(type) __weak typeof(type)weak##type = type;

#define kStrongSelf(type)__strong typeof(type)type = weak##type;

//View圆角和加边框

#define ViewBorderRadius(View,Radius,Width,Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

/**屏幕的Bounds*/
#define SCREEN_RECT  [[UIScreen mainScreen] bounds]

/**屏幕的高度*/
#define SCR_HEIGHT [[UIScreen mainScreen]bounds].size.height

/**屏幕的宽度*/
#define SCR_WIDTH  [[UIScreen mainScreen]bounds].size.width

/**tabBar高度*/
#define TABBAR_HEIGHT 49

/**navBar高度*/
#define NAVBAR_HEIGHT ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0 ? (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 64:44):(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 64:64))

/**当前版本号*/
#define CURRENT_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

/**大于等于7.0的ios版本*/
#define iOS7_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")

/**大于等于8.0的ios版本*/
#define iOS8_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")



//自定义log输出
#ifdef DEBUG  // 在开发阶段

#define NSLog(fat, ...) NSLog((@"%s [Line %d] " fat), __FUNCTION__, __LINE__, ##__VA_ARGS__)

#else  // 非开发阶段, 也就意味着  打包上架阶段  releas

#define NSLog(...)

#endif

#endif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值