Reputation: 6054
im trying to make a month calendar in swift, but im strugging with an auto layout issue.
I need 7 squares side to side, and i want to make them responsive. I have tryied to set every square trailling and leading based on the preview and next square, but it wont work without setting the width (what will make it go unresponsive). Can someone help me please?
Upvotes: 0
Views: 596
Reputation: 8718
If you know there's always 7 cells in a row (sounds like it, calendars are pretty stable that way), you want to set up a width relationship.
Set the width of the first cell to the width of the parent view ("Equal Widths"). Sounds strange at first
But then double-click on the resulting constraint in the Constraints Inspector to get the detailed constraint editor.
Set the Multiplier to "1:7"
Set the Constant to some small value to allow for inter-cell padding.
Set all the other cells to equal the width of the first cell.
Upvotes: 2