swift - instagram 故事布局集合视图 swift - 以编程方式
问题描述
我想知道如何更好地设置 UI:目标是完成一个类似 instagram 提要的界面,例如:
根据我的检查,它似乎是collectionView
带有标题的,在该标题中放置了所有故事(圆形元素)的水平集合视图。
如果我在collectionView
内部设置 a,viewController's view
我可以使用控制器在视图(collectionView)和模型(firestore 后端)之间使用 MVC 进行调解。
如果我collectionView
在以这种方式设置的标题内设置水平:
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: headerIdentifier, for: indexPath)
return headerView
}
我如何在 和 之间进行viewcontroller
通信collectionview's header
?使用代表?我不知道哪个是最好的解决方案,因为使用标题对我来说似乎不是最好的选择。
如果你有更好的选择,我会很乐意倾听。
解决方案
推荐阅读
- c# - 在形状上使用 LINQ
- java - Intellij Idea 有时不会按照应有的方式构建应用程序
- javascript - 如何在 SAPUI5 中更改 sap.m.Table 的字体大小?
- sql - Informatica SQL 转换中的联接查询失败
- sql - SQL Server 2017 嵌套插入或在另一插入中使用一个插入的结果
- javascript - 将函数变量发送到外部 ajax 调用
- firebase - 如何检查firestore数据库中的文档中是否存在字段?
- 3d-reconstruction - 具有已知内在和外在矩阵的立体视觉 3d 点计算
- graph - 在图顶点之间找到图边的简单方法
- wordpress - Wordpress 多站点 - 映射多个域名 - 作为主要