Reputation: 61
I have been trying to hide and show UIView which is in tableviewcell based on cell selection.when the cell is selected, then the view should be visible and if the cell index is changed then the view should be invisible in the last selected cell and should be visible in current selected cell.If any one helps me would be great,Thanks in advance.
Upvotes: 0
Views: 69
Reputation: 413
Implement the UITableView Delegate method
tableView:didSelectRowAtIndexPath:
And in this method store the selected row in a variable and reloads your tableview. Then in
tableView:cellForRowAtIndexPath:
show/hide the view for the row based on the selected row variable.
Upvotes: 1
Reputation: 125
Put the Views in Tableviewcell inside a stackView & then on cell selection in didselectRow you can simply hide or unhide views.
Upvotes: 0