After many games, I think this is a mistake. When working with iPhone 6, your Image.xcassets must upload 568h@2x.png (640 x 1136). Xcode should scale to 750 X 1334. But this is not so, it always downloads an iPhone 4 image (320 x 640). To get around this problem, I created two sets of Image.xcassets (Device Specific) as follows:
- backGround.xcassets - 1x (320 x 640) - 2x (640 x 960) - 3x (2208 x 1242) - //(uncheck 4- Retina) - backGroundRetina.xcassets - 2x (640 x 1136) - //(only iPhone checked)
In (void) viewDidLoad {
if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ){ CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width; if( screenHeight < screenWidth ){ screenHeight = screenWidth; } if ( screenHeight > 480 && screenHeight < 736 ){ NSLog(@"RUNNING IPHONE 5 or 6"); [_backGround setImage:[UIImage imageNamed:@"backGroundRetina"]]; } else NSLog(@"THIS IS NOT IPHONE 6");
I am sure that there are other ways to solve this problem, but this is what works for me, and I hope that it helps other people to depend on the same problem.
source share