gpt4 book ai didi

ios - 如何在 Swift 中为 Collection View 添加边框?

转载 作者:行者123 更新时间:2023-11-28 10:13:37 28 4
gpt4 key购买 nike

不是 Collection View 单元格,我通过在我的 ViewController 中应用特定的边框函数(例如 borderColor 和 cornerRadius 方法)来解决这个问题。我说的是用一个边框封装整个单元格 View ,有点像这样:

The collection view cell that I want to achieve

非常感谢。

最佳答案

在您的 ViewDidLoad 函数中,只需添加这种类型的行(选择您的值)。

collectionView.layer.borderColor = UIColor.green.cgColor
collectionView.layer.borderWidth = 3.0
collectionView.layer.cornerRadius = 3.0//if you want corner radius.addtional

enter image description here

关于ios - 如何在 Swift 中为 Collection View 添加边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44425874/

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