Tuesday, May 15, 2012

thumbnail

Where to define macros in iPhone development/ Objective C

Macros in Iphone

The simple way is take constant.h and write all macro there.we have .pch class and import the constant.h into the .pch(pre compile header) file.No need to import constant.h file to each and every viewcontroller.




#define DLog(...) NSLog(@"[%d] = %s [L:%d]--- %@",[NSThread isMainThread], __PRETTY_FUNCTION__,__LINE__, [NSString stringWithFormat:__VA_ARGS__]);
#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]
#define LOC(key) NSLocalizedStringFromTable((key),@"Localizable", @"")
#define START_EXCEPTION @try {
#define END_EXCEPTION }@catch (NSException * e) {DLog(@"Exception in %@", [e description]);}

Subscribe by Email

Follow Updates Articles from This Blog via Email

1 Comments

comments

About me

simple one.