iOS获取plist文件属性值的方法

来源:互联网 发布:妩媚的女生 知乎 编辑:程序博客网 时间:2024/06/06 16:29

在项目中,很多的属性都是在plist文件中设置的,在开发过程中,经常会需要获取这些属性值,下面是获取plist属性值的方法

NSDictionary *bundleDic = [[NSBundle mainBundle] infoDictionary];

NSString *version = [bundleDic objectForKey:@"CFBundleVersion"];

其中,CFBundleVersion为plist文件的key。

plist文件的所有键值如下:

    CFBundleDevelopmentRegion,

    DTPlatformName,

    CFBundleVersion,

    LSRequiresIPhoneOS,

    CFBundleSignature,

    CFBundleIdentifier,

    CFBundleExecutable,

    CFBundleDisplayName,

    CFBundleShortVersionString,

    CFBundleName,

    CFBundleSupportedPlatforms,

    CFBundlePackageType,

    NSBundleResolvedPath,

    CFBundleInfoDictionaryVersion,

    UIRequiredDeviceCapabilities,

    UISupportedInterfaceOrientations,

    NSBundleInitialPath,

    CFBundleInfoPlistURL,

    CFBundleExecutablePath,

    DTSDKName,

    UIDeviceFamily



原文:http://blog.csdn.net/qijianli/article/details/7759659

0 0
原创粉丝点击