NSString* imageName = [NSString stringWithFormat:@"LaunchImage%s%s%s%s", iOS7Suffix, orientSuffix, szSuffix, ipadSuffix]; if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) { //iPhone5/5s/iPod5 if([[UIScreen mainScreen] bounds].size.height == 568 || [[UIScreen mainScreen] bounds].size.width == 568) imageName = @"LaunchImage-568h@2x"; //iPhone6 if([[UIScreen mainScreen] bounds].size.height == 667 || [[UIScreen mainScreen] bounds].size.width == 667) imageName = @"LaunchImage-800-667h@2x"; //iPhone6 Plus if([[UIScreen mainScreen] bounds].size.height == 736 || [[UIScreen mainScreen] bounds].size.width == 736) imageName = @"LaunchImage-800-Landscape-736h@3x"; } //NSLog(@"===\nLaunchIamgeName:%@\n===", imageName); NSString* imagePath = [[[[NSBundle mainBundle] pathForResource: imageName ofType: @"png"] retain] autorelease];
原文地址:http://blog.csdn.net/cdztop/article/details/39718461