Making a UIButton a % of the screen size

前端 未结 4 1483
再見小時候
再見小時候 2021-01-13 00:57

I noticed certain button sizes look great on one the iPhone 5 simulator but do not look as good on the iPhone 6 simulator and this is because the heights or constraints that

4条回答
  •  萌比男神i
    2021-01-13 01:16

    This function gives you the bounds of the screen

    var bounds = UIScreen.mainScreen().bounds

    And then you can set the button width multipliying 0.4 x bounds.size.width

    Regards

提交回复
热议问题