且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Swift - UIScrollView不滚动

更新时间:2023-11-18 07:52:09

您需要设置UIScrollView的大小,使其小于contentsize。否则它不会滚动。

You need to set the size of your UIScrollView so that it is less then the contentsize. Otherwise it won't scroll.

我还建议添加 scroller.contentSize = CGSizeMake(400,2300)到您的 viewDidLoad 方法。

Also I would recommend to add scroller.contentSize = CGSizeMake(400, 2300) to your viewDidLoad method.