iOS随笔小记

iOS随笔小记-- 常用的一些宏定义

2017-06-06  本文已影响2人  七一小月

extern BOOL whetherHaveNetwork;

/**  动画时间  */

static const NSTimeInterval YDAnimateTime = 0.5;

//#define YDAnimateTime 0.5

/** 无数据时的提示文字*/

#define noGoodsRemaindText    @"当前无数据,请管理员云平台上传!"

/**  RGB颜色  */

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

#define YDColorAlp(r, g, b, alp) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:alp]

#define YDColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

/**  随机色  */

#define YDRandomColor kColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256))

/**  系统主题颜色  */

#define YDSystemColor YDColor(15, 23, 27)

/**  系统主题图文颜色 */

#define YDSystemTextImageColor YDColor(68, 90, 114)

/**  白色  */

#define YDWhiteColor YDColor(255, 255, 255)

/** red TintColor  */

#define YDselectedTintColor YDColor(240, 79, 88)

/**  每一页的数据  */

#define YDLimitPageNum @(20)

/**  注册 tableView  */

#define YDRegisterTableViewNib(tableView,nibName) [tableView registerNib:[UINib nibWithNibName:nibName bundle:nil] forCellReuseIdentifier:nibName]

/**  注册 CollectionView  */

#define YDRegisterCollectionViewNib(collectionView,nibName) [collectionView registerNib:[UINib nibWithNibName:nibName bundle:nil] forCellWithReuseIdentifier:nibName]

/**  弱引用  */

#define YDWeakSelf __weak typeof(self) weakSelf = self;

/**  沙盒Document路径  */

#define YDDocumentPath ([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject])

/**  沙盒Cache路径  */

#define YDCachePath ([NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject])

/**  屏幕高度  */

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

/**  屏幕宽度  */

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

/**  弧度转角度  */

#define YDRADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI))

/**  角度转弧度  */

#define YDDEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)

/**  是否为iOS7  */

#define iOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0)

/**  是否为4inch  */

#define FourInch ([UIScreen mainScreen].bounds.size.height >= 568.0)

上一篇 下一篇

猜你喜欢

热点阅读