for the consistence of the app,I hava declared some const string in global.h:
extern NSString *const GDD_UI_COMFIRM_TITLE;//comfirm button title
extern NSString *const GDD_UI_CANCELL_TITLE;//cancell button title
and defined them in global.m:
NSString *const GDD_UI_COMFIRM_TITLE = @"ok";
NSString *const GDD_UI_CANCELL_TITLE = @"cancel";
Now,I need a global array like:
NSArray *GDD_STATUS_CONFIG = @[ @{
@"title":@"a",
@"color":[UIColor redColor]
},
@{
@"title":@"b",
@"color":[UIColor grayColor]
}];
I want to access the array the way just like the global const string so that the code could look consistent,but it will be error if I declare and define the array in global.h/.m. someone suggest to use a class to wrap the array,but it meet my consistent requirement. btw,I heard someone say it is not a good idea to use global variable,is there any substitute of global variable?
THX.
Aucun commentaire:
Enregistrer un commentaire