问题描述
如果我想在使用自动布局的应用设置按钮的背景图片在iOS中,如果PNG图片是什么尺寸?自的高度,并且该按钮将始终变化,除了容纳于视网膜/ nonretina显示宽度(@ 2×?)。
If I want to set a button's background image in iOS in an app that uses autolayout, what size should the .png image be? Since the height, and width of the button will always vary, in addition to accommodating for retina/nonretina displays (@2x?).
推荐答案
您可以提供适当的命名约定正常,@ 2倍,3倍@,〜iPad的等。
You can add multiple images with providing proper naming conventions normal, @2x, @3x, ~iPad etc.
对于通过苹果单证。
例如,你的形象的名字叫 myBackground.png
然后
For that go through Apple documentations.For example, your image name is myBackground.png
then
[UIImage imageForDeviceWithName:@"myBackground"];
然后这里是文件和决议的名单 myBackground
[email protected] == 960×640
[email protected] == 1136×640
[email protected] == 1136 × 640
[email protected] == 1334×750
[email protected] == 1334 × 750
[email protected] == 2208×1242
[email protected] == 2208 × 1242
myBackground〜ipad.png == 1024×768
myBackground~ipad.png == 1024 × 768
myBackground@2x~ipad.png == 2048×1536
myBackground@2x~ipad.png == 2048 × 1536
您需要添加图像,景观带后缀添加像一样:〜景观
Same way you require to add images for landscape with suffix added like: ~Landscape
这篇关于对于UI图像针对不同屏幕尺寸的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!