#define KYRect [UIScreen mainScreen].bounds
//获取启动图片
CGSize viewSize = KYRect.size;
//横屏请设置成 @"Landscape"
NSString *viewOrientation = @"Portrait";
NSString *launchImageName = 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"]])
{
launchImageName = dict[@"UILaunchImageName"];
}
}
UIImage * launchImage = [UIImage imageNamed:launchImageName];
//将当前view的背景图设置为启动图片
self.view.backgroundColor = [UIColor colorWithPatternImage:launchImage];