獲取對應(yīng)分辨率的尺寸圖片,無需硬編碼判斷分辨率寫圖片尺寸獲取
CGSize viewSize = self.window.bounds.size;
NSString *viewOrientation = @"Portrait"; //橫屏請設(shè)置成 @"Landscape"
NSString *launchImage = nil;
NSArray* imagesDict = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"UILaunchImages"];
for (NSDictionary* dict in imagesDict)
{
CGSize imageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);
if (CGSizeEqualToSize(imageSize, viewSize) && [viewOrientation isEqualToString:dict[@"UILaunchImageOrientation"]])
{
launchImage = dict[@"UILaunchImageName"];
}
}