Created
May 24, 2011 10:07
-
-
Save eiffelqiu/988462 to your computer and use it in GitHub Desktop.
Common Macro for iphone/ipad project
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
#ifdef __OBJC__ | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
#define HEXCOLOR(c) [UIColor colorWithRed:((c>>24)&0xFF)/255.0 \ | |
green:((c>>16)&0xFF)/255.0 \ | |
blue:((c>>8)&0xFF)/255.0 \ | |
alpha:((c)&0xFF)/255.0]; | |
#endif | |
static inline BOOL isEmpty(id thing) { | |
return thing == nil | |
|| (thing == [NSNull null]) | |
|| ([thing respondsToSelector:@selector(length)] | |
&& [(NSData *)thing length] == 0) | |
|| ([thing respondsToSelector:@selector(count)] | |
&& [(NSArray *)thing count] == 0); | |
} | |
#define ALog(format, ...) NSLog((@"%s [L%d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#ifdef DEBUG | |
#define RSLog(format, ...) ALog(format, ##__VA_ARGS__); | |
#else | |
#define RSLog(...) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment