gpt4 book ai didi

ios - 如何设置 UICollectionView 填充 UIEdgeInsets

转载 作者:行者123 更新时间:2023-11-28 12:42:29 25 4
gpt4 key购买 nike

你好,我有 UIControllerView ,我用下面的代码设置了 UIEdgeInsets

  self.automaticallyAdjustsScrollViewInsets = false
self.collectionView.contentInset = UIEdgeInsets(top: 10, left: 10, bottom: 100, right: 10)

我的 ContentView 代码

 let contentWidth = maxWidthInASection
let contentHeight = Double(collectionView!.numberOfSections())
self.contentSize = CGSize(width: Double(contentWidth), height: contentHeight)
self.contentSize.height = CGFloat(Double(collectionView!.numberOfSections()))

但是不起作用,用户没有选择底部 cells,因此当用户自动滚动到底部单元格时,我需要添加底部填充大小 50- 100 px,例如空白区域。

第二个是;

When users scrolling collection view cells after collection view goes first opened position i want to disable it if user touch and move collection view anywhere must be stay there dont be goes firstly position ?

我下面的示例图片用于底部填充

enter image description here

我该怎么做?

谢谢!

最佳答案

 let flow: UICollectionViewFlowLayout = CollectionView.collectionViewLayout as! UICollectionViewFlowLayout
flow.sectionInset = UIEdgeInsetsMake(70, 0, 0, 0)

关于ios - 如何设置 UICollectionView 填充 UIEdgeInsets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39100606/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com