不是集合视图单元格,我通过在 ViewController 中应用特定的边框函数(例如 borderColor 和cornerRadius 方法)来解决这个问题。我说的是用一个边框封装单元格的整个视图,有点像这样:
非常感激。
在你的 ViewDidLoad 函数中,只需添加这种类型的行(选择你的值)。
collectionView.layer.borderColor = UIColor.green.cgColor
collectionView.layer.borderWidth = 3.0
collectionView.layer.cornerRadius = 3.0//if you want corner radius.addtional
Run Code Online (Sandbox Code Playgroud)