In my Table View, I have a list of instructions (1 cell = 1 instruction). I am trying to make it so that:
- User taps on the top cell
- The screen automatically scrolls so that the 2nd cell is now on the top
Example:
Before tapping the first cell:
After tapping the first cell:
I’ve been researching, and a lot of people seem to use a removeObjectAtIndex
command to remove the cell that was tapped, but in my case:
- The user should still be able to scroll down to reveal that tapped cell again, so it’s not technically removed, but moved out of the view until the user wants to move it back into view
- Only the next index can be tapped to reveal this functionality
Would someone be able to point me to the right direction to a method that could accomplish this? I’ve experienced similar in many apps so I feel like something must exist out there to use. I would think this method would be nested within func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
.
I’ve been thinking that the defaulted top cell would always satisfy both of the following conditions:
- Cell has not been tapped
- Lowest index count
Any help/guidance is much appreciated!