Created
October 16, 2014 09:05
-
-
Save ruandao/c3d5dd49fa1976fcfef9 to your computer and use it in GitHub Desktop.
Prefix.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef yahame_Prefix_h | |
| #define yahame_Prefix_h | |
| #if !defined(DEBUG) | |
| //#define NSLog(...) ; | |
| #endif | |
| #define NS_USERDEFAULT [NSUserDefaults standardUserDefaults] | |
| #define LocStr(key) NSLocalizedString(key,@"") | |
| #define UIColorFromRGB(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 UI_TOP_VIEW [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject] | |
| #define NULL_TO_NIL(obj) ({ __typeof__ (obj) __obj = (obj); __obj == [NSNull null] ? nil : obj; }) | |
| #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) | |
| /// For when you need a weak reference of an object, example: `BBlockWeakObject(obj) wobj = obj;` | |
| #define BlockWeakObject(o) __typeof__(o) __weak | |
| /// For when you need a weak reference to self, example: `BBlockWeakSelf wself = self;` | |
| #define BlockWeakSelf BlockWeakObject(self) | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment