objective-c - 以步进增量滚动水平 UIScrollView?

标签 objective-c ios cocoa-touch uiscrollview ios5

我有一个可以水平滚动的 UIScrollView。可滚动内容显示在列中。

有没有办法让滚动只以步进增量而不是像素移动(即一次移动一列)。

示意图: enter image description here

最佳答案

是的,有:

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 水平居中,并确保包含 UIScrollViewUIView 的宽度是UIScrollView

关于objective-c - 以步进增量滚动水平 UIScrollView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8246988/

相关文章:

ios - 是否应该为 Swift 类添加前缀以避免潜在的 Objective-C 兼容性冲突问题

iphone - 如何比较 Objective C 中的日期

objective-c - NSLayoutConstraints 和动态设置 View 的宽度/高度

ios - 您的二进制文件不支持iPad Phonegap

ios - 写入可由应用程序中的 JS 文件读取的 txt 文件

ios - 为逗号添加任何字母/数字的上标

objective-c - NSTableView 与窗口右侧对齐?

ios - iphone 在检测到接近传感器时振动多次但仅振动一次

iphone - UIActionSheet addButtonWithTitle : doesn't add buttons in the right order

objective-c - UITabBarItem finishedImageSelected 放置偏移标签栏