DSBaseModuleMacro.h
1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// DSBaseModuleMacro.h
// BKProjectFramework
//
// Created by BIKE on 2018/7/6.
// Copyright © 2018年 BIKE. All rights reserved.
//
#ifndef DSBaseModuleMacro_h
#define DSBaseModuleMacro_h
/* 编译错误解决:implicit declaration of function 'close' is invalid in C99
#import <sys/time.h>
#import <fcntl.h>
#import <unistd.h>
*/
#import <sys/time.h>
#import <fcntl.h>
#import <unistd.h>
#pragma mark - 当前窗口
#define DS_APP_KEY_WINDOW [[[UIApplication sharedApplication] delegate] window]
#pragma mark - 屏幕宽高
#define DS_SCREENW [UIScreen mainScreen].bounds.size.width
#define DS_SCREENH [UIScreen mainScreen].bounds.size.height
#pragma mark - 颜色
#define DS_RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define DS_RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define DS_HEX_RGB(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 DS_HEX_RGB_A(rgbValue,a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
#pragma mark - 常用定义
#ifdef DEBUG
#define DSLog(...) NSLog(__VA_ARGS__)
#else
#define DSLog(...)
#endif
#define DS_POINTS_FROM_PIXELS(__PIXELS) (__PIXELS / [[UIScreen mainScreen] scale])
#define DS_ONE_PIXEL DS_POINTS_FROM_PIXELS(1.0)
#define DS_WEAK_SELF(obj) __weak typeof(obj) weakSelf = obj;
#define DS_STRONG_SELF(obj) __strong typeof(obj) strongSelf = weakSelf;
#endif /* DSBaseModuleMacro_h */