ios - Xcode 6 not displaying correct image size for iPhone 6 simulator -
ios - Xcode 6 not displaying correct image size for iPhone 6 simulator -
ive been next tutorial https://www.youtube.com/watch?v=_36y6rdckp0 on using image.xcassets display total screen images on different devices. creating launch items easy placeholders displayed. but, problem when creating new image set follows.
the images have placed in each placeholder follows:
1x bg.png (320 x 640) 2x bg@2x.png (640 x 960) retina 4 2x bg-568h@2x.png (640 x 1136) 3x bg@3x.png (2208 x 1242)my problem when run iphone 6 simulator loads bg@2x.png (640 x 960) image instead of the bg-568h@2x.png (640 x 1136) image iphone 6? (the image stretched). other images sizes right each device. on video tutorial the iphone 6 simulator load bg-568h@2x.png (640 x 1136). doing wrong ??
after lot of playing around believe bug. when running iphone 6, image.xcassets should load 568h@2x.png (640 x 1136). xcode should scale 750 x 1334. doesn't, loads iphone 4 (320 x 640) image. work round problem have created 2 sets of image.xcassets (device specific) 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 not iphone 6"); // [_background setimage:[uiimage imagenamed:@"background"]]; called }
im sure there other ways solve problem whats working me , hope helps other people stuck same problem.
ios iphone xcode
Comments
Post a Comment