Manually enqueue reusable UITableViewCells?
I have some custom table view cells that takes a while to draw, so the first time you scroll it's not very smooth. After the first scroll, all the views are cached and the scrolling is very smooth.
So what I'm wondering is if I could draw all the cells and cache them before the table view is shown and how I would do that. Would there be a problem if I spawned a thread that drew the cells in the background, so that they likely would be drawn when the table view needs them?
Would I have to set up my own dictionary or could I use the table view's dequeueReusable开发者_如何学JAVACellWithIdentifier:?
I do not know a way to predraw a UIView. A view is only drawn, if it's on the screen. What you could do is to try to draw the contents of the cell to a CGBitmapContext, create a UIImage of that context, and in your actual cell only use an imageview which shows the image.
In this case you would of cause need an external storage for the images. Could be array or dictionary.
精彩评论