Is there any ground rule for using methods like drawRect, setNeedsDisplay and layoutSubViews? I believe they adversely affect the app performance. Is there any preferred alternatives for these messages?
Asked
Active
Viewed 2,213 times
1 Answers
1
While this isn't an exact duplicate of this question, I believe my answer there still applies.
In summary, -drawRect:
will redraw the content within a view, which is an expensive operation. Avoid redrawing if you can by layering content and moving or hiding those layers as needed.
However, these redraws typically will only have a significant performance impact if there are many of them done in rapid succession, like when trying to animate content. One-off redraws of static UI elements will not perceptively slow things down.

Community
- 1
- 1

Brad Larson
- 170,088
- 45
- 397
- 571