CGSize viewSize = self.window.bounds.size;
NSString * viewOrientation = @"Portrait";
NSString * launchImage = nil;
NSArray * imageDict = [[[NSBundle mainBundle] infoDictionary]valueForKey:@"UILaunchImages"];
for (NSDictionary * dict in imageDict) {
CGSize imageSize = CGSizeFromString(dict[@"UILaunchImageSize"]);
if (CGSizeEqualToSize(imageSize, viewSize) && [viewOrientation isEqualToString:dict[@"UILaunchImageOrientation"]]) {
launchImage = dict[@"UILaunchImageName"];
}
}
_launchImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:launchImage]];
self.window.backgroundColor = [UIColor whiteColor];
_launchImg.frame = self.window.bounds;
_launchImg.contentMode = UIViewContentModeScaleAspectFill;