Storyboard UIScrollView contentSize?

后端 未结 8 1735
-上瘾入骨i
-上瘾入骨i 2020-12-14 20:20

I feel like I have touched on every single possible cause for stopping this, but I have a UIScrollView in my Storyboard hooked up with an outlet and in the viewDidLoad I set

8条回答
  •  独厮守ぢ
    2020-12-14 20:59

    viewDidLoad is not a good place to put code that relies on frame sizes of IB objects. If you log the contentSize of your scroll view in viewDidLoad, you will see that it's (0,0). Move the code (where you set the content size) to viewDidAppear, and it will work properly.

提交回复
热议问题