003 | #define
nilToEmpty(object) (object!=nil)?object:@"" |
006 | #ifndef
formatStringOfObject |
007 | #define
formatStringOfObject(object) [NSString stringWithFormat:@"%@", object] |
010 | #ifndef
nilToEmptyFormatStringOfObject |
011 | #define
nilToEmptyFormatStringOfObject(object) formatStringOfObject(nilToEmpty(object)) |
018 | #define
imagePath(imageName) [[NSBundle mainBundle] pathForResource:imageName ofType:@"png"] |
023 | #define
RGBA(r, g, b, a)[UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a] |
024 | #define
RGB(r, g, b)RGBA(r, g, b, 1.0f) |
025 | #define
HEXCOLOR(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0f green:((c>>8)&0xFF)/255.0f blue:(c&0xFF)/255.0f alpha:1.0f]; |
029 | #define
debug(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |
033 | #define
SUPPORT_IPHONE_OS_VERSION(version) ( __IPHONE_OS_VERSION_MIN_REQUIRED <= version && __IPHONE_OS_VERSION_MAX_ALLOWED >= version) |
036 | //
Application delegate |
037 | #define
ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) |
041 | #define
UserDefaults[NSUserDefaults standardUserDefaults] |
042 | #define
NotificationCenter [NSNotificationCenter defaultCenter] |
043 | #define
SharedApplication [UIApplication sharedApplication] |
046 | #define
Bundle [NSBundle mainBundle] |
048 | #define
MainScreen [UIScreen mainScreen] |
052 | #define
ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES |
053 | #define
HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO |
054 | #define
NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x |
058 | #define
NavBar self.navigationController.navigationBar |
059 | #define
TabBar self.tabBarController.tabBar |
063 | #define
ScreenWidth [[UIScreen mainScreen] bounds].size.width |
064 | #define
ScreenHeight[[UIScreen mainScreen] bounds].size.height |
066 | #define
NavBarHeightself.navigationController.navigationBar.bounds.size.height |
067 | #define
TabBarHeightself.tabBarController.tabBar.bounds.size.height |
070 | #define
TouchHeightDefault 44.0f |
071 | #define
TouchHeightSmall32.0f |
074 | #define
ViewWidth(v)v.frame.size.width |
075 | #define
ViewHeight(v) v.frame.size.height |
076 | #define
ViewX(v)v.frame.origin.x |
077 | #define
ViewY(v)v.frame.origin.y |
080 | #define
SelfViewWidth self.view.bounds.size.width |
081 | #define
SelfViewHeight self.view.bounds.size.height |
084 | #define
RectX(rect)rect.origin.x |
085 | #define
RectY(rect)rect.origin.y |
086 | #define
RectWidth(rect)rect.size.width |
087 | #define
RectHeight(rect) rect.size.height |
090 | #define
RectSetWidth(rect, w) CGRectMake(RectX(rect), RectY(rect), w, RectHeight(rect)) |
091 | #define
RectSetHeight(rect, h) CGRectMake(RectX(rect), RectY(rect), RectWidth(rect), h) |
092 | #define
RectSetX(rect, x) CGRectMake(x, RectY(rect), RectWidth(rect), RectHeight(rect)) |
093 | #define
RectSetY(rect, y) CGRectMake(RectX(rect), y, RectWidth(rect), RectHeight(rect)) |
096 | #define
RectSetSize(rect, w, h)CGRectMake(RectX(rect), RectY(rect), w, h) |
097 | #define
RectSetOrigin(rect, x, y) CGRectMake(x, y, RectWidth(rect), RectHeight(rect)) |
102 | #if
! __has_feature(objc_arc) |
103 | #define
SBAutorelease(__v) ([__v autorelease]); |
104 | #define
SBReturnAutoreleased SBAutorelease |
106 | #define
SBRetain(__v) ([__v retain]); |
107 | #define
SBReturnRetained SBRetain |
109 | #define
SBRelease(__v) ([__v release]); |
111 | #define
SBDispatchQueueRelease(__v) (dispatch_release(__v)); |
114 | #define
SBAutorelease(__v) |
115 | #define
SBReturnAutoreleased(__v) (__v) |
118 | #define
SBReturnRetained(__v) (__v) |
120 | #define
SBRelease(__v) |
124 | #if
__IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 |
126 | #define
SBDispatchQueueRelease(__v) |
129 | #define
SBDispatchQueueRelease(__v) (dispatch_release(__v)); |
132 | //
Compiling for Mac OS X |
133 | #if
MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
134 | //
Mac OS X 10.8 or later |
135 | #define
SBDispatchQueueRelease(__v) |
137 | //
Mac OS X 10.7 or earlier |
138 | #define
SBDispatchQueueRelease(__v) (dispatch_release(__v)); |
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理