1、关于获取info.plist文件里的一些属性
info.plist文件里的属性值都可以用以下方法获取:
[[[NSBundle mainBundle] infoDictionary] valueForKey:@"key"] 或者
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"key"];
如:Version版本号的值:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] 或者
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
构建版本号 Build的值:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
或者[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];
以下附一些常用的key:
const CFStringRef kCFBundleInfoDictionaryVersionKey;
const CFStringRef kCFBundleExecutableKey;
const CFStringRef kCFBundleIdentifierKey;
const CFStringRef kCFBundleVersionKey;
const CFStringRef kCFBundleDevelopmentRegionKey;
const CFStringRef kCFBundleNameKey;
const CFStringRef kCFBundleLocalizationsKey;
2、关于代码获取资源管理xcassets文件里的启动图片等;
最近使用资源管理启动图片,然后代码获取资源管理里的启动图片,怎么获取都拿不到,imagename 和
imageWithContentsOfFile 都还是拿不到图片;
最后查了相关资料,是因为启动图片命名问题,必须按照规定的命名方式才能拿到图片;
具体的对应的启动图片名称如下:
LaunchImage-568h@2x.png (640×1136)
LaunchImage-700-568h@2x.png (640×1136)
LaunchImage-700@2x.png (640×960)
LaunchImage-800-667h@2x.png (750×1334)
LaunchImage-800-Portrait-736h@3x.png (1242×2208)
LaunchImage.png (320×480)
LaunchImage@2x.png (640×960)
完.....