作者:鸣丸子圓的睿哥 | 来源:互联网 | 2023-01-31 17:35
1> SwiftStudier..:
尝试将代码移动到这样的cellForRowAt
方法中
cell.layer.masksToBounds = true
cell.layer.cornerRadius = 5
cell.layer.borderWidth = 2
cell.layer.shadowOffset = CGSize(width: -1, height: 1)
let borderColor: UIColor = (stock[indexPath.row] == "inStock") ? .red : .green
cell.layer.borderColor = borderColor.cgColor