ios - UICollectionView - 滚动出界

标签 ios swift uicollectionview

我有一个 UICollectionView ,假设宽度为 200。我可以毫无问题地垂直滚动。但我希望能够将 collectionView 向右滚动 60 px。这可能吗?

最佳答案

当然可以,UICollectionView继承自UIScrollView,这意味着您可以添加插入。这意味着您将滚动更多,但放置单元格的内容大小将相同。

SWIFT
var contentInset: UIEdgeInsets
OBJECTIVE-C
@property(nonatomic) UIEdgeInsets contentInset
Use this property to add to the scrolling area around the content. The unit of size is points. The default value is UIEdgeInsetsZero.

还记得添加一个 scrollIndicatorInsets 来平衡滚动条的移动。

关于ios - UICollectionView - 滚动出界,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36059912/

相关文章:

ios - 关闭模态视图后删除模态模糊效果

ios - Swift 中的 Firebase 嵌套查询无法正常工作

ios - UIViewController里面CollectionViewCell内存问题

swift - CollectionView Cell 图像正在变化

ios - 滚动到 Collection View 中的项目会使应用程序崩溃

ios - 关闭游戏中心 View

iphone - [NSCFString viewWillAppear :]: unrecognized selector sent to instance on iPhone 3G but not on simulator or iPhone 4

ios - 区域/地理围栏监控 iOS 中区域的形状

ios - 在 ViewWillAppear 和 ViewWillDisappear UI 故障处隐藏/显示导航栏

swift - 如何在 FMDB + Swift 3 中处理 NULL