029-用到的宏定义

1 先 建立一个 pch 文件
2 配置路径
3 我这里用的 是 头文件 不是 .pch

//
//  JFConfigFile.h
//  LivePlayerDemo
//
//  Created by ArrQ on 16/8/25.
//  Copyright © 2016年 ArrQ. All rights reserved.
//

#ifndef JFConfigFile_h
#define JFConfigFile_h
#import "Masonry.h"

#define JFSCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width//屏幕宽度
#define JFSCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height//屏幕高度


#define KMainBodyColor [UIColor colorWithRed:255/255.0f green:89/255.0f blue:66/255.0f alpha:1]//navigationBar主题颜色

#define JFRandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]//获取随机颜色

#define JFRGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define JFRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]

#define JFClearColor [UIColor clearColor]// clear背景颜色
/** 自定义Log */
#ifdef DEBUG
#define JFLog(...) NSLog(@"%s 第%d行 \n %@\n\n",__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define JFLog(...)

#endif

#define JFWeakSelf(type)  __weak typeof(type) weak##type = type;//弱引用
#define JFStrongSelf(type)  __strong typeof(type) type = weak##type;//强引用

//判断是否为iPhone
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

//判断是否为iPad
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

//判断是否为ipod
#define IS_IPOD ([[[UIDevice currentDevice] model] isEqualToString:@"iPod touch"])

// 判断是否为 iPhone 5SE
#define iPhone5SE [[UIScreen mainScreen] bounds].size.width == 320.0f && [[UIScreen mainScreen] bounds].size.height == 568.0f

// 判断是否为iPhone 6/6s
#define iPhone6_6s [[UIScreen mainScreen] bounds].size.width == 375.0f && [[UIScreen mainScreen] bounds].size.height == 667.0f

// 判断是否为iPhone 6Plus/6sPlus
#define iPhone6Plus_6sPlus [[UIScreen mainScreen] bounds].size.width == 414.0f && [[UIScreen mainScreen] bounds].size.height == 736.0f

//获取系统版本
#define IOS_SYSTEM_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

//判断 iOS 8 或更高的系统版本
#define IOS_VERSION_8_OR_LATER (([[[UIDevice currentDevice] systemVersion] floatValue] >=8.0)? (YES):(NO))

#if TARGET_OS_IPHONE
//iPhone Device
#endif

#if TARGET_IPHONE_SIMULATOR
//iPhone Simulator
#endif


//当前版本
#define RCDLive_IOS_FSystenVersion ([[[UIDevice currentDevice] systemVersion] floatValue])
// weakself  的 宏定义
#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self;
#define kUSERDEFAULTS [NSUserDefaults standardUserDefaults] //用户信息单例


#endif /* JFConfigFile_h */

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,860评论 18 139
  • 国家电网公司企业标准(Q/GDW)- 面向对象的用电信息数据交换协议 - 报批稿:20170802 前言: 排版 ...
    庭说阅读 11,106评论 6 13
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,936评论 6 342
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,996评论 25 708
  • 古有壮志豪情之言, 今闻难题涌现呻吟。 望明月,思难解, 挠头乱绪,思前顾后。 终无果,泪奔,湿透卷轴!
    disguise128阅读 176评论 0 0