您如何配置收集视图列表单元格以看起来插入圆角?
在健康应用中,看来细胞而不是部分以这种方式进行了样式:
我知道的最接近此外观的是将部分设置为插图,
let listConfiguration = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
let listLayout = UICollectionViewCompositionalLayout.list(using: listConfiguration)
collectionView.collectionViewLayout = listLayout
但我不确定在上面的屏幕截图中像在每个单元格中一样的好方法。我假设显示的列表样式收集视图是两个部分,其中有三个总单元格,而不是三个插图分组的部分。
In the Health app, it appears that cells and not sections are styled in this way:
The closest I know of to getting to this appearance is setting the section to be inset grouped
let listConfiguration = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
let listLayout = UICollectionViewCompositionalLayout.list(using: listConfiguration)
collectionView.collectionViewLayout = listLayout
but I'm not sure of a good approach to giving each cell this appearance like in the screenshot above. I'm assuming the list style collection view shown is two sections with three total cells, rather than three inset grouped sections.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将这些行添加到您的收集视图单元格中(单独的单元格设计)。旋转文件,
它将有助于添加边框和半径,您可以根据需要自定义
Add these lines into your collection view cell (separate cell design).swift file
it will help in adding the border and radius you can customise as required
在Swiftui中,我知道您可以做到这一点:
将
.cornerradius
添加到每个项目或其背景不确定在
uikit
中
使用
uihostingview
(或像这样的sth)桥接?In SwiftUI, I know you can do this:
Add
.cornerRadius
to each of the items or its backgroundNot sure in
UIKit
Use
UIHostingView
(or sth like that) to bridge?