I have the following draw(_ rect: CGRect)
function
override public func draw(_ rect: CGRect) {
super.draw(rect)
for (i, time) in times.enumerated() {
let fontSize = style.font.pointSize
let timeRect = CGRect(x: 2, y: y,
width: style.leftInset, height: fontSize)
let timeString = NSString(string: time)
timeString.draw(in: timeRect, withAttributes: attributes)
}
}
In some scenarios I want to remove all the previous drawed NSString objects from the UIView and redraw again. But it seems there is no API to do that?
Can anyone help?
update
When setNeedsDisplay is called the UIView gets rid of all it's previous drawings. But for some reason after the second time I call the drawRect method my strings gets fuzzy.