Created
March 29, 2012 01:00
-
-
Save garaemon/2232015 to your computer and use it in GitHub Desktop.
UtilityMacros.h
This file contains 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
#define DICT(...) ([NSDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil]) | |
#define MDICT(...) ([NSMutableDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil]) | |
#define FORMAT(...) ([NSString stringWithFormat:__VA_ARGS__]) | |
#define ARRAY(...) ([[NSArray alloc] initWithObjects:__VA_ARGS__, nil]) | |
#define MARRAY(...) ([[NSMutableArray alloc] initWithObjects:__VA_ARGS__, nil]) | |
#define ASSOC(D, K) ([D objectForKey:K]) | |
#define PREDICATE(F, ...) ([NSPredicate predicateWithFormat:F, __VA_ARGS__]) | |
#define LOCALIZED_STRING(S) (NSLocalizedString(S, S)) | |
#define IS_VALID_STRING(s) (s && s != NULL && ![s isEqual:[NSNull null]]) | |
#define CG_RECT_MAKE_SHORT(N) (CGRectMake(N##_X, N##_Y, N##_WIDTH, N##_HEIGHT)) | |
#define UI_FONT_SHORT(N) ([UIFont fontWithName:N size:N##_SIZE]) | |
#define RGB(R,G,B) ([UIColor colorWithRed:R green:G blue:B alpha:1.0]) | |
#define RGBA(R,G,B,A) ([UIColor colorWithRed:R green:G blue:B alpha:A]) | |
#define RGB255(R,G,B) ([UIColor colorWithRed:R/255.0 \ | |
green:G/255.0 \ | |
blue:B/255.0 \ | |
alpha:1.0]) | |
#define RGBA255(R,G,B, A) ([UIColor colorWithRed:R/255.0 \ | |
green:G/255.0 \ | |
blue:B/255.0 \ | |
alpha:A]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment