/*
1. NSLog replacement. Using LLog(); will ensure that not a
single NSLog(); call will make it into the release build
*/
#if RELEASE
#define LLog(content, ...) // Comment
#else
#define LLog(content, ...) NSLog(content, ##__VA_ARGS__)
#endif
/*
2. Ever wish there was an easy way to set a custom color? Using
the following macro you can set colors just like you do in
CSS with rgb(255,255,255)
*/
#define RGB(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]
/*
3. Writing a universal app for iPhone and iPad? This macro will
prove to be invaluable
*/
#define IS_IPAD ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
#define IS_IPHONE ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
/*
4. You never know when you'll need the AppDelegate around, but
when you do, its always there with this macro
This macro will require that you import your AppDelegate
in order to use it effectively
*/
#import "AppDelegate.h"
#define appDelegate (AppDelegate *)[[UIApplication sharedApplication] delegate]
I have few more useful macros that i created