目前,项目使用Assert.xcassets管理AppIcon和LaunchImage。一旦设置以后,这个图片就会被拷贝一份到应用程序中,存放在一个单独的文件夹内。因此,应用中其他的地方如Resource不需要再存储这些图片,最好不要先复制到工程中,再设置,建议直接从外面的文件夹设置。
这些图片有点特殊,被单独存放以后,我们想要使用的话如何去获取呢?
打印一下
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSLog(@"%@", infoDictionary);
输出结果
{
BuildMachineOSBuild = 15G1004;
CFBundleDevelopmentRegion = "zh_CN";
CFBundleExecutable = CTQProject;
CFBundleIcons = {
CFBundlePrimaryIcon = {
CFBundleIconFiles = (
AppIcon29x29,
AppIcon40x40,
AppIcon60x60
);
};
};
CFBundleIdentifier = "com.chuangtoubang.ctb";
CFBundleInfoDictionaryVersion = "6.0";
CFBundleName = "\U732b\U6295\U9e70";
CFBundleNumericVersion = 620789760;
CFBundlePackageType = APPL;
CFBundleShortVersionString = "1.0.7";
CFBundleSignature = "????";
CFBundleSupportedPlatforms = (
iPhoneSimulator
);
CFBundleURLTypes = (
{
CFBundleTypeRole = Editor;
CFBundleURLName = weixinPay;
CFBundleURLSchemes = (
wxb14d804bd2c92f26
);
},
{
CFBundleTypeRole = Editor;
CFBundleURLName = alipay;
CFBundleURLSchemes = (
chuangtoubang
);
}
);
CFBundleVersion = 25;
DTCompiler = "com.apple.compilers.llvm.clang.1_0";
DTPlatformBuild = "";
DTPlatformName = iphonesimulator;
DTPlatformVersion = "10.0";
DTSDKBuild = 14A345;
DTSDKName = "iphonesimulator10.0";
DTXcode = 0800;
DTXcodeBuild = 8A218a;
LSApplicationQueriesSchemes = (
weixin,
wechat
);
LSRequiresIPhoneOS = 1;
MinimumOSVersion = "7.0";
NSAppTransportSecurity = {
NSAllowsArbitraryLoads = 1;
};
NSCameraUsageDescription = "\U732b\U6295\U9e70\U9700\U8981\U8c03\U7528\U60a8\U7684\U624b\U673a\U76f8\U673a\Uff0c\U53ef\U4ee5\U5417\Uff1f";
NSLocationWhenInUseUsageDescription = "\U732b\U6295\U9e70\U9700\U8981\U4f7f\U7528\U5b9a\U4f4d\U670d\U52a1\U6765\U641c\U7d22\U9879\U76ee\U548c\U6295\U8d44\U4eba";
NSMicrophoneUsageDescription = "\U732b\U6295\U9e70\U9700\U8981\U4f7f\U7528\U60a8\U7684\U9ea6\U514b\U98ce\Uff0c\U53ef\U4ee5\U5417\Uff1f";
NSPhotoLibraryUsageDescription = "\U732b\U6295\U9e70\U9700\U8981\U8bbf\U95ee\U60a8\U7684\U624b\U673a\U76f8\U518c\Uff0c\U53ef\U4ee5\U5417\Uff1f";
UIDeviceFamily = (
1
);
UILaunchImages = (
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-Portrait-736h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{414, 736}";
},
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-667h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{375, 667}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 480}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700-568h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 568}";
}
);
UIRequiredDeviceCapabilities = (
armv7
);
UIStatusBarHidden = 0;
UISupportedInterfaceOrientations = (
UIInterfaceOrientationPortrait
);
UIViewControllerBasedStatusBarAppearance = 1;
}
其中
CFBundleIcons = {
CFBundlePrimaryIcon = {
CFBundleIconFiles = (
AppIcon29x29,
AppIcon40x40,
AppIcon60x60
);
};
};
...
UILaunchImages = (
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-Portrait-736h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{414, 736}";
},
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-667h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{375, 667}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 480}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700-568h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 568}";
}
);
记录的就有图片的名称,可以通过imageNamed直接调用。
具体代码可以参考:https://www.ianisme.com/ios/1825.html