开发者

Performance issues : UIView coregraphics drawing inside a Customcell

I am implementing a UItableView with custom cells. My custom cell has a UIView inside of it.

I am trying to draw extensive CoreGraphics shapes with gradients in the UIView and I am running into scrolling performance problems -- since the customcell's UIView is getting drawn upon everytime the cell gets displayed.

Are there ways where I could do this differently (such as say, some kind of lazy drawing, drawing asynchronously, UIView caching, preventing the cell from redrawing etc) so as to improve performance?

Deeply appreciate any help, inputs, insight开发者_JAVA技巧s.


The idea is not to compute your graphics every time at draw time, but to render it offscreen in a UIImageView. Then your cell only has to blit the image, which is as fast as can be.

You can still compute your images lazily and asynchronously. The structure of your code could be similar to the Apple sample code LazyTableImages. Google for it. In that sample code, what's slow is not the drawing time, but the network loading time, but that difference is not significant.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜