Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Device Info & Version Check
- #define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
- #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
- #define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)
- #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
- #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
- #define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
- #define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))
- #define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
- #define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
- #define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
- #define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
- #define IS_MultiTaskingSupported ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [[UIDevice currentDevice] isMultitaskingSupported])
- #define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
- #define IS_OS_5_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0)
- #define IS_OS_6_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0)
- #define IS_OS_7_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
- #define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
- // Timer Invalidation
- #define m_invalidateTimer(t) [t invalidate]; t = nil;
- // Threading
- #define m_runOnMainThread if (![NSThread isMainThread]) { dispatch_sync(dispatch_get_main_queue(), ^{ [self performSelector:_cmd]; }); return; };
- // Colors
- #define m_rgba(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
- #define m_rgb(r,g,b) UA_rgba(r, g, b, 1.0f)
- // Debugging / Logging
- #ifdef DEBUG
- //#define DLog( s, ... ) NSLog( @"%@ %s [%d] \t%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __func__, __LINE__ ,[NSString stringWithFormat:(s), ##__VA_ARGS__])
- //#define DLog( s, ... ) NSLog( @"%@ [%d] \t%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__ ,[NSString stringWithFormat:(s), ##__VA_ARGS__])
- #define DLog( s, ... ) NSLog( @"%s [%d] \t%@", __func__, __LINE__ ,[NSString stringWithFormat:(s), ##__VA_ARGS__] )
- #else
- #define DLog( s, ... )
- #endif
- #define DLogBounds(view) DLog(@"%@ bounds: %@", view, NSStringFromRect([view bounds]))
- #define DLogFrame(view) DLog(@"%@ frame: %@", view, NSStringFromRect([view frame]))
- // Others
- #define NSStringFromBool(b) (b ? @"YES" : @"NO")
- #define m_SHOW_VIEW_BORDERS YES
- #define m_ShowDebugBorderForViewWithColor(view, color) if (UA_SHOW_VIEW_BORDERS) { view.layer.borderColor = color.CGColor; view.layer.borderWidth = 1.0; }
- #define m_showDebugBorderForView(view) UA_showDebugBorderForViewColor(view, [UIColor colorWithWhite:0.0 alpha:0.25])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement