开发者

common parameters in iphone

How can I define common parameters in iPhone to use everywhere in different c开发者_运维百科lasses.


Write and retrieve your parameters from a .plist file:

NSString *filePath = @"Parameters.plist";
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];

NSString *value = [plistDict objectForKey:@"parameterName"];


You can also add common definitions class file (e.g. AppConstansts.h), fill it with defines (e.g. #define CELL_HEIGHT 44.0) and add an import line (#import "AppConstansts.h") in <Your project name>_Prefix.pch file that is usually located under "Other Sources" group in the project.

After doing it CELL_HEIGHT will be accessible from all your source files...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜