How to set subviews with AutoLayout in UIScrollView programmatically?

前端 未结 4 2127
忘掉有多难
忘掉有多难 2020-12-29 10:17

I am creating app with UiScrollview and UIPagectontrol using Autolayout Programmatically, for

I have Created TKScroller as subclass of UIView, I am init it

4条回答
  •  遥遥无期
    2020-12-29 11:04

    In my experience with AutoLayout (that I use programmatically too). You should not add views directly to your UIScrollView.

    You should do one UIView and only one, that you add as subview of your UIScrollView.

    Once this is done, you can add all of your subviews to this UIView.

    Everything is explained in detail here : Apple iOS Technical Note TN2154

提交回复
热议问题