gpt4 book ai didi

ios - UIcollection View 不滚动?

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

我在我的应用程序中添加了一个 UICollectionView。我已经给出了它的约束,例如 Collection View 的前导、尾随、顶部和一些固定高度。它正在显示所有项目。但我无法滚动它。请问是什么问题?

   func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {

return 1
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

print("count is \(arr_collection.count)")
return arr_collection.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

let identifier="col_cell"
let cell:CollectionCell
cell=collectionView.dequeueReusableCellWithReuseIdentifier(identifier, forIndexPath: indexPath ) as! CollectionCell
cell.img_cell.image=UIImage(named: arr_collection[indexPath.row])
print("arr collection is \(arr_collection[indexPath.row])")
return cell
}

最佳答案

默认情况下,界面构建器中的 CollectionViews 启用了“Bounces”属性,但您必须指定它弹跳的方向。如果您不这样做,并且 CollectionView 的内容不超过 Collection View 的边界,您将无法滚动。 enter image description here

关于ios - UIcollection View 不滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39567125/

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