我有一个可以水平滚动的 UIScrollView。可滚动内容显示在列中。
有没有办法让滚动只以步进增量而不是像素移动(即一次移动一列)。
示意图:
最佳答案
是的,有:
yourScrollView.pagingEnabled = YES;
检查 UIScrollView获取更多信息。
If the value of this property is YES, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is NO.
我建议您可能需要将 View 结构更改为如下所示:
+--------+
| | <- UIView to hold your structure
+--------+
+--+
| | <- UIScrollView, clipsToBounds = NO, width = column.width
+--+
+--+--+--+
| | | | <- UIView columns
+--+--+--+
将 UIScrollView
水平居中,并确保包含 UIScrollView
的 UIView
的宽度是UIScrollView
关于objective-c - 以步进增量滚动水平 UIScrollView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8246988/