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 都還是拿不到圖片;
最後查了相關資料,是因爲啓動圖片命名問題,必須按照規定的命名方式才能拿到圖片;
具體的對應的啓動圖片名稱如下:
[email protected] (640×1136)
[email protected] (640×1136)
[email protected] (640×960)
[email protected] (750×1334)
[email protected] (1242×2208)
LaunchImage.png (320×480)
[email protected] (640×960)
完.....