问题
This is driving me nuts!
I am trying to show a row of images of followers to a profile in my app. The idea is for it to be 5 images where you could theoretically click on them and move to their profile.
Here is what I am having troubles with now :
I've never had to ask about auto layout before so I don't know what to show you all for your help. Is feel like this is a silly problem...
Here is the setup:
- Designed in a separate XIB
- All elements are encapsulated in a UITableViewCell
Any help would be appreciated.
EDIT: So as per Michal I tried a stack view and although it seemed like the right thing to do it honestly gave me the same results, so I am sure I am doing this wrong. Please see images below
回答1:
I figured I would make this an answer so that the comments don't get too long. So, with everything these are the constraints you should have added:
1) Set all UIImageView's to have equal widths
2) Set all UIImageView's aspect ratio constraint
3) Add a height constraint to each UIImageView
4) Set all UIImageView's to have equal heights, just like with width in step 1
5) Set leading and trailing space constraints for each UIImageView. This one is a little tricky. The first UIImageView should have a leading constraint = x. The last UIImageView should have a trailing constraint = x. The constraints between each UIImageView should be >= x.
This is the icon for selecting constraints:
来源:https://stackoverflow.com/questions/35442912/auto-layout-issue-with-a-row-of-image-views