ios中底部UIButtons的自动布局问题

时间:2016-06-01 14:25:43

标签: ios xcode autolayout constraints

我正试图在每个按钮尺寸上用UIButtons(连续5个按钮)创建Custom-Tabbar:w:75 h:55完全适合iPhone-6和iPhone-6Plus

当我试图在iPhone 5屏幕上添加约束(宽度等于和边距点数)时,按钮会失去它们的比例并且看起来像是被粉碎了一点。

iPhone5输出: http://image.prntscr.com/image/51e1de65d2dd462a837efb0dc5e357c1.png

在iPhone-6Plus上完美匹配的原始布局:

enter image description here

我的问题是,如何在没有混乱比例的情况下在每个设备屏幕上成功实现此布局?

问候,

奥德

2 个答案:

答案 0 :(得分:1)

您需要在每个按钮上添加宽高比约束。并确保将乘数设为1(使宽度等于高度)。

enter image description here enter image description here

答案 1 :(得分:0)

将UIImageView的contentMode属性设置为.ScaleAspectFit

imageView.contentMode = .ScaleAspectFit
相关问题