【发布时间】:2019-03-20 05:50:24
【问题描述】:
我正在尝试在我的集合视图单元格内绘制一个简单的轮廓圆圈。出于某种原因,只有第一个单元格被绘制,其余的没有显示。
class UserCell: UICollectionViewCell {
override func draw(_ rect: CGRect) {
let center = CGPoint(x: self.center.x - 1, y: 41)
let circularPath = UIBezierPath()
circularPath.addArc(withCenter: center, radius: 36, startAngle: 0, endAngle: CGFloat(2 * Double.pi), clockwise: true)
UIColor.red.setStroke()
circularPath.lineWidth = 2
circularPath.stroke()
}
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor.white
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
我在这里错过了什么?
【问题讨论】:
标签: ios swift uicollectionview