if you want to scroll tableview smooth, several tips you should pay attention.
Cache the height of the rows (the table view can request this frequently), -- actually this point isn't the key point to block your tableview scroll.
Create a least-recently-used cache for the images used in the table (and invalidate all the inactive entries when you receive a memory warning) -- you can use SDWebImage to download image and cache them. And sometimes, you maybe want to cache some images that your tableview frequently used and these images could also don't free even you receive a memory warning if your current view is the top view。
Draw everything in the
UITableViewCell
'sdrawRect:
if possible avoid subviews at all costs (or if you require the standard accessibility functionality, the content view'sdrawRect:
) -- it could save some cost, but it also may cost your more time to code and maybe hard to maintain codes. But it is really good to use less views on uitableviewcell, that will improve your performance.Make your
UITableViewCell
's layer opaque (same goes for the content view if you have one) -- please use layer opaque as less as possible.Use the reusableCellIdentifier functionality as recommended by the
UITableView
examples/documentation -- you must follow this tips.Avoid gradients/complicated graphical effects that aren't pre-baked into
UIImage
s -- like point 4.
of course, most time, if your tableview scroll not smooth, the main problem is that you load image in synchronize.
it's really good to use instruments to test the performance.