iOS: autolayout for multiple button

2020-02-13 05:36发布

In my app I have a view for 4 inch screens in this way:

enter image description here

And then I want to reduce the size of my buttons when the app is running on an iPhone with a 3.5 inch screen, so I set my layout in this way:

enter image description here

but finally I obtain a view in this way

enter image description here

In this way the size of my button are ok but they are not aligned, so in this situation, what's the way to have aligned buttons?

thanks

2条回答
孤傲高冷的网名
2楼-- · 2020-02-13 06:05

I may not comment till I 50 posts, so here is the link. I had like the same problem some days ago. Just put all those in a parent view and center the parent view.

Link to my question/answer: Top constraint won't get less with auto-layout

查看更多
做自己的国王
3楼-- · 2020-02-13 06:32

Hi as per your question i've created demo similar to the layout for which you need the controls need to set. I've added images for single control and made video this using multiple controls to set the layout which you retrying to set.

enter image description here enter image description here



link: https://www.youtube.com/watch?v=Nl2iMF0yKW8&list=PLXCowKcXAVgrxHKLWTa4HxNPrSmTj3D-_
Hope this will solve your issue.

查看更多
登录 后发表回答