Yes, I do this in the application I'm working on now.
You need to track the state the cell is in, open or closed. If only one cell can be opened at a time, you can do this by simply providing a link to the current index. If several cells can be opened at the same time, you will need an array of logic elements that keeps track of whether each of them is open or closed.
In heightForRowAtIndexPath, simply return the correct height based on whether the row is open or closed.
In cellForRowAtIndexPath, if the row is closed, hide all content that should not be visible when it is closed. Views can still be there, but they must be set to hidden = YES .
Finally, in the didSelectRowAtIndexPath file, specify the specified pointer path if it was closed and closed if it was open, then reload the cell using [tableView reloadRowsAtIndexPaths:] . If you allow only 1 time to open, then just set the current open path of the pointer to the one that was selected, and reload both the one that was selected and the one that was previously opened.
source share