This is due to the way I use notifications to update the GUI if changes to the datamodel are made. I think that the way I work is pretty normal:
- an update to the data model is made,
- a notification is raised so that the GUI knows that an update is needed,
- the GUI calculates which part of the view must be updated,
- and uses setNeedsDisplayInRect to request the update
Luckily this is simple, just override setNeedsDisplayInRect to prevent updates to non-visible areas.
For my view I used the following:
override func setNeedsDisplayInRect(invalidRect: NSRect) {
let reqRect = visibleRect.intersect(invalidRect)
if reqRect.size.width > 0 && reqRect.size.height > 0 {
super.setNeedsDisplayInRect(reqRect)
}
}
Happy coding...
Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH
We don't get the world we wish for... we get the world we pay for.
No comments:
Post a Comment