简体   繁体   中英

xcode image size isn't consistent through ios models

I am aware this question must have been asked before, but after 2 hours of searching and failure to find a working answer, I decided to ask again.

As you all know, each iOS model has a different screen size. However when I insert my logo (or any image) into my app, it maintains a specific size for whatever iOS model I preview it in, therefore it is too small on the 6+, yet doesn't fit on the screen on the 4.

Using code or not, how can I make my images be the same scale on each iOS model?

To achieve what you are asking for you can just use Constraints throughout your project. The easiest way would probably be to just make an aspect ratio constraint on your image view. However that will only keep the ratio of width to height the same. In order to make it fit onto all the screens, you should simply add some constraint to your image view, as for example trailing space to container margin . You can set those through here:

屏幕截图

If you set for example 0,0,0 then this will keep your logo in the upper part of yur screen and always fitting into the screen. You may also want to consider adding a height constraint, so your logo doesn't get compressed.

Hope that helps,

Julian

在图像盒中,您需要有一个@ 3x和一个@ 2x,然后它将为正确的设备选择正确的图像尺寸。

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