My button is centered for iPhone 6 and 6 plus, but not for iPhone 5

谁都会走 提交于 2019-12-20 04:56:16

问题


I do have autolayout on, but for some reason my center button isn't being centered for other phone sizes. I have constraints set and like I mentioned autolayout, so I'm somewhat confused. All other items are where they should be, buttons, other labels, etc. One specific label at the top is just off center for all models aside from iPhone 6.


回答1:


If I am not wrong you didn't add any constraint to your label that's why it is not at center.

Add this constraint for label.

Result for all screen:




回答2:


i'm just adding video and setting constraints with rightclick on the outlet and selection done with left click

this is tested in all the device so just watch and apply you can solve your problem and if you want to arrange your view so you can add new constraints which is required otherwise you can set these 4 constraints set and execute.

just watch this video and setting your constraints

you tube link to setting constraints in autolayout to centering button



来源:https://stackoverflow.com/questions/32132478/my-button-is-centered-for-iphone-6-and-6-plus-but-not-for-iphone-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!