Skip to content

Instantly share code, notes, and snippets.

@ast3150
Forked from luoph/get-launch-image.mm
Created November 6, 2018 15:57
Show Gist options
  • Save ast3150/7f9bf9af23a56c16bdfce9ec60b3010e to your computer and use it in GitHub Desktop.
Save ast3150/7f9bf9af23a56c16bdfce9ec60b3010e to your computer and use it in GitHub Desktop.
iOS get App Launch Image
+ (UIImage*)getLaunchImage
{
UIImage* launchImage = nil;
NSArray* imagesDict = [[MainBundle infoDictionary] valueForKey:@"UILaunchImages"];
for (NSDictionary* dict in imagesDict) {
CGSize launchImageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);
if (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, launchImageSize)) {
launchImage = [UIImage imageNamed:dict[@"UILaunchImageName"]];
break;
}
}
return launchImage;
}
@ast3150
Copy link
Author

ast3150 commented Nov 6, 2018

Added a break after a launchImage is found. It will probably make not much of a difference but is better practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment