简体   繁体   中英

How to scale images to different iPhone screen using storyboards?

I am developing an app in which i am displaying certain images such as delete icon,search icon.I have images by names are

  • delete.png
  • delete@2x.png
  • delete@3x.png

    I have created images.xcassets & added the images in that for 1x,2x & 3x. Now i have added an UIImageView on story board & it's default image is delete.png(32*32) it runs fine on 3.5 inch screen but images does not scale on 4.7 & 5.5 inch screen iPhone. Can some one please help me out.What to & how to do it?

I thick @Banning and @Fatti Khan suggestion will be the solution of the problem. Instead of using image name as delete.png use just delete as a ratio set the images with the exact size as example if the 1x image is 30 px then 2x must be 60px and 3x 90px

1x images are for the original iPhone through the 3GS - 'standard' resolution devices (3.5" screens)

2x images are for the iPhone 4, 4S (3.5" Retina screens) and also iPhone 6.

Retina 4 2x are for the iPhone 5 and 5s (4" Retina screens)

3x images are for the new iPhone 6+ (5.5" super-Retina [3x] screen)

在此处输入图片说明

EDIT: please clean your project and then check again (cmd+shift+k) of delete your derived data. also check your view is autolayout enable or disable.

or

add The launch image Default-568h@2x.png as i thought your Code unable to detect the different type of screens it have,so follow this steps

  1. First I would like to suggest that,
  2. Preapre all Images,
  3. Select Project from Project Navigator And Go to Summary and scroll down this screen appears, then right click on that and choose file from your computer it will automatically copied to project and it will entered in plist file also..
  4. if your application is universal then you have to set for iPhone and iPad Both. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM