我在storyboard中设置layout,假如我设置了button, 水平居中,我可不可以设置button的宽度为屏幕宽度的百分比?
伊谢尔伦2017-04-17 15:21:57
Select the button and click control to connect to viewController.view, which is the view with the usual screen width
Select
Then click Size inspector->Constraints to find the corresponding item, click Edit, and adjust the multiplier
迷茫2017-04-17 15:21:57
This is possible, but the setting is not the ratio to the screen, but the ratio to Superview. UIViewController.view.width
Equivalent to screen width.
Because there are a lot of steps, I wrote an article specifically. Storyboard usage tips: Use proportional layout