ios - Understanding iPhone 5/6 resolution on image.xcassets -
as title says, i'm still confused understand how image.xcassets handles iphone 5/6 images. let me explain better:
this menu_empty_list
file in image.xcassets. i've been looking answer here in stackoverflow , found this:
1x images original iphone through 3gs - 'standard' resolution devices (3.5" screens)
2x images iphone 4, 4s (3.5" retina screens) , iphone 6.
retina 4 2x iphone 5 , 5s (4" retina screens)
3x images new iphone 6+ (5.5" super-retina [3x] screen)
this helped me lot question is: if image set background (in short, image covering screen)? how can handle different screen size? have put "2x" square? iphone 4/4s image or iphone 6?
only 1 problem iphone 4 , iphone 6 taking same @2x images.
so, if want set perfect image devices have try following code :
if([[uiscreen mainscreen]bounds].size.height==480) { login_bg.image=[uiimage imagenamed:@"i4_login.png"]; } else if ([[uiscreen mainscreen]bounds].size.height==568) { login_bg.image=[uiimage imagenamed:@"i5_login.png"]; } else if ([[uiscreen mainscreen]bounds].size.height==667) { login_bg.image=[uiimage imagenamed:@"i6_login.png"]; } else if ([[uiscreen mainscreen]bounds].size.height==736) { login_bg.image=[uiimage imagenamed:@"i6+_login.png"]; } else if ([[uiscreen mainscreen]bounds].size.height==1024) { login_bg.image=[uiimage imagenamed:@"ipad_login.png"]; }
Comments
Post a Comment