Reputation: 737
i am experiencing problems with my UITableView. I am using custom cells, which have a subview with a dropdown menu. But since cells are reusable, once one of my custom cell's subviews is "dropped down", the next reused cell is also "dropped down", messing up the cell height and the subview.
Is it possible to reuse cells and to keep the cells frame for the original cell but also have the reused cell not being "dropped down"?
Thank you!
Upvotes: 0
Views: 318
Reputation: 1093
Clean up before the cell is sent to the tableview in the prepareForReuse in the tableviewcell
Upvotes: 1
Reputation: 9612
In your UITableViewCell subclass you should override prepeareForReuse
method(ObjC)/function(Swift) - to turn off cell drop down
mode.
Swift:
override func prepareForReuse() {
super.prepareForReuse()
//set cell to initial state here - turn off drop down mode
}
Objective-C:
-(void)prepareForReuse {
[super prepareForReuse];
//set cell to initial state here - turn off drop down mode
}
Upvotes: 1