xcode - Managing iPhone 5 and iPhone 6 image sizes -


i new programming , xcode , struggling setting image size iphone 5 , iphone 6. apparently both iphone 5 , 6 use @2x image while 6+ use @3x image. can design 6+ perfectly, since both iphone 5 , 6 use same image , have different screen size/ resolution, mu screen design impacted.

if design images per iphone 6 size, images appear big on iphone 5 , if design them iphone 5 appear small on iphone 6. should simple, missing?

please help!

instead of directly using images should create entry them in images.xcassets. select in project navigator.

enter image description here

then drag , drop @3x or @2x version of image images folder list of images in images.xcassets window. automatically generate new entry. drag other (@2x or @3x) image proper position. in end.

enter image description here

once done can use in uiimageview, or image button or whatever in storyboard name without @2x or @3x.

now answer question. should handle of image sizes constraints in storyboard. instance if want same margins on either side of image create constraints between size of uiimageview contains image , edge of superview. way image resized each new screen.

enter image description here

edited add careful of constrain margins check box want consistent using or not otherwise behavior didn't plan for. uncheck , have constraints go superview edge, doesn't matter long consistent across app won't confused.


Comments