Note that there are some explanatory texts on larger screens.

plurals
  1. POis it possible to make a tableview with complex subviews scroll smooth like butter
    text
    copied!<p>In my tableview, I am using custom cells, which have many subviews on them, two egoimageviews (subclass of imageview that takes a URL and fetches images from the web and then caches them for later use), a textview with link detection turned on, 4 labels, and a button. I have added tap gestures to the egoimageview as well as the textview. The height of the textview is calculated as per the size of the text it holds. The height calculations are done well in advance, so that the scroll performance is not affected due to height calculation on the fly while the user scrolls. All this data is fetched from the web, then text heights and cell heights are calculated and stored in an array, before tableview gets added as a subview. For some cells, there are no images to display, so in those cases I simply hide my egoimageview after setting its frame to cgrectzero. The images occupy some 170 px X 100 px on the iphone screen, and are approximately 250 KB each. When i scroll, the scroll is quite jerky. I have done a bit of research on slow scrolling cells, and I have implemented the following so far without a significant performance improvement:</p> <ol> <li>Heights are calculated well in advance, not in heightforrow method.</li> <li>Cell backgrounds, and backgrounds of their subviews are opaque.</li> <li>There are two ways in which the data layout has to look like, so I have two similar kinds of custom cell classes with some differences, so as per the content, the cell type to return is decided, though 90% of the times, only the first kind is used.</li> </ol> <p>I am not really satisfied with this jerky scroll, and have been looking up the web in frustration for something to get it scrolling butter smooth despite all that complex layout, but nothing has helped so far. Please help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload