Post not yet marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as unsolved with 1 replies, 0 views
Replied In
UIView draw always draws the whole frame
So I set up the most minimal project I could exhibiting the behaviour and it still happens.
For some reason it took me a whole day to realise a workaround was to just keep track of the draw rectangle myself, overriding the setNeedsDisplay functions to store it in my own variable. Works lightning fast now :)
var actualDrawRect : CGRect?
override func setNeedsDisplay(_ rect : CGRect) {
super.setNeedsDisplay(rect)
if actualDrawRect == nil {
actualDrawRect = rect
} else {
actualDrawRect = actualDrawRect!.union(rect)
}
}
override func setNeedsDisplay() {
super.setNeedsDisplay()
actualDrawRect = CGRect(origin: .zero, size: bounds.size)
}