iOS: Autolayout causing UIScrollView to not scroll

后端 未结 3 708
抹茶落季
抹茶落季 2021-01-04 08:18

I have set up a UIScrollView with which I want to display 12 images (only 8 fit on screen) laid out horizontally. In the following image you can see the problem

3条回答
  •  無奈伤痛
    2021-01-04 08:55

    Two Solutions:

    1. Create different constraints that can be satisfied simultaneously (you will have to edit). I think the problem is your bottom space and top space constraints are mutually exclusive. please remove one and try again. IF this is difficult for you, try adding another UIView to contain the UIScrollView to help manage your constraints, it might seem odd at first, but sometimes adding another view to contain your view actually makes it simpler at each level.

    2. Turn off Autolayout, and change the autoresize masks of your UIImageView to be what you wish.

提交回复
热议问题