1

I have a collectionView consisting of 100 imageViews INSIDE my expandable tableView. When I click on a cell of my tableView (to expand it), I change the height of the tableview to 4000 to display my collectionView of 100 imageViews When I click again (collapse) i reduce the height of tableView so that the collectionView isn't visible anymore

Both these cases result in a delay that would ruin the user experience

How can i make it more smooth and is there a better way to go about this than what i'm currently doing?

I am using:

self.tableView.beginUpdates()
self.tableView.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.None)
self.tableView.endUpdates()

to update the height of my tableview cell.

  • show the full code – hariszaman Aug 13 '16 at 17:17
  • 2
    Place a breakpoint on the line where you reload the rows. When executed, check what thread you are on. If it is not the main thread, then you need to add a call to do so. – CodeBender Aug 13 '16 at 17:20
  • It did become slightly faster but still slow AND it's initially messing up the background color i set around my imageViews – Georges Kfoury Aug 13 '16 at 18:07
  • So that indicates you have a threading issue. Without more code to see, it is pure guesswork to troubleshoot. – CodeBender Aug 13 '16 at 20:14
  • https://stackoverflow.com/questions/48442971/ios-how-to-create-expandable-tableview-in-swift-without-using-third-parties-and/51964908#51964908 check my answer here , if any help :) – Rishabh Shukla Mar 19 '19 at 09:29

0 Answers0