UIScrollView + Centered View + Ambigous Scrollable Content Size + many iPhone sizes

前端 未结 3 1997
暗喜
暗喜 2020-12-24 12:43

I have:

  • application, that should work in landscape and portrait mode.
  • view with full-size scroll view on top.
  • some view inside scroll view wi
3条回答
  •  清歌不尽
    2020-12-24 13:34

    Problem :

    1. The warning is telling us that the the content size of the scrollview depends on its subviews.
    2. while your subview don't have any strict rule of position and size (no fixed constraints) it will confuse nib generated scrollview content size.

    Solution :

    1. Make only one subview as a 'contentView' for scrollview.

    2. Add strict (fixed) constraints to that 'contentView'.

      Best practice : equal width and height to its scroll view.

    3. Add all other subviews and constraints to your 'contentView'.

提交回复
热议问题