swift - 如何快速使 Collectionview 单元格彼此靠近?
问题描述
我需要一个相邻的单元格,如下所示
但我是这样的:在短电话中,它们彼此相距甚远
对于collectionview,我给出了限制:
height = 80, leading = trailing = 0, top = 20
在 viewdidload 中:
override func viewDidLoad() {
super.viewDidLoad()
//services collectionview cell
let serviceLayout = UICollectionViewFlowLayout()
serviceLayout.minimumInteritemSpacing = 0
serviceLayout.minimumLineSpacing = 0
serviceLayout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
self.servicesCollectionView.collectionViewLayout = serviceLayout
servicesCollectionView.contentInsetAdjustmentBehavior = .always
servicesCollectionView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
除了这个,我还没有给出任何东西..请帮忙..让collectionview单元彼此靠近
解决方案
推荐阅读
- java - IntelliJ 升级后 Jar 文件不运行
- c# - 当不同的线程和库变量更改时更新 C# WPF GUI
- python - 多处理 python 包是否适用于 Google Cloud ml-engine?
- javascript - 在javascript中检索深度嵌套的对象时不使用两次查找
- r - 通过 R 使用 Linux Azure DSVM 进行 SSH 公钥身份验证
- python - python 的 dict .get() 方法如何检查默认参数?
- java - Flink:可以在 X 时间后删除 Queryable 状态吗?
- c# - 如何使用类库(.NET Framework)在 C# 中创建文件 excel?
- php - Symyfony 3.4 - 如何将实体移动到其他数据库
- python - 如何读取 Spark 日志文件?.Iz4 或 .snappy