8 ms·
I wish Apple would publish a list of common misconceptions including things like this. I see lots of code where tons of UI drawing is being done that could (and
by andrewroycarter 14y ago
I wish Apple would publish a list of common misconceptions including things like this. I see lots of code where tons of UI drawing is being done that could (and should) be done with images because it's "hardcore" and "fast". But no- it's over complicated and slow!
- andymatuschak 14y agoMany of these are places where people are caching rasterizations of deep layer hierarchies to avoid paying the compositing cost on a per-frame basis. But if you do that with drawRect:, you're using the CPU (not the GPU); if you use your own images, you're on the hook for your own caching, which you're likely to mess up. Such cases should probably use -[CALayer setShouldRasterize:] instead. For more about this stuff, check out the two WWDC sessions I mentioned above.