1

I am using Storyboard for layout (PS. I don’t want to use any code to layout yet).

I created a stack view and put some buttons in it. These buttons immediately lost their width and height, and became very small. I checked some tutorials and they told me to add constraints to the stack view. Although I feel that these constraints have nothing to do with whether resizing is allowed or not, I added some, but the resize option on the panel is still gray.

Next, I found that in the constraints I can add width and height to the button. This is the only method I found that workaround.

But I got a warning

Fixed width constraints may cause clipping.

I have a lot of questions:

  1. How to resize the subview in StackView?
  2. Constraints are not as easy to use as responsive layouts in the front end, why we need it?
  3. Can the width be expressed as a percentage in the storyboard?

I think the layout of iOS is completely unreasonable, is there any recommended tutorial?

  • there are a good many resources and answers about your question, pleace deep dive into google first so that improve your skills – roadRunner Sep 26 '20 at 15:54
  • Look at equal width and height constraints. You can in fact make it percentage based – agibson007 Sep 26 '20 at 16:42
  • @Momozawa Regarding the last question you asked, check out this question: https://stackoverflow.com/questions/26373598/how-to-create-percentage-of-total-width-using-autolayout/26373646 – Essam Fahmi Sep 26 '20 at 17:00

0 Answers0