Quote:
Originally Posted by ncohen
Hi everyone, I would like to create an effect to a cell of a UITableView. The effect is: duplicate the cell and move the duplicated cell (the original stays at its place). My problem is to duplicate the cell...
I've tried:
Code:
UITableViewCell *animatedCell = [[UITableViewCell alloc] init];
animatedCell = [[self cellForRowAtIndexPath:indexPath] copy];
but UIView doesn't seem to implement the copy... How can I do it?
Thanks
|
You shouldn't try to manipulate the cells in a table view directly. That's not how it works.
What you do is to tell the table view that you want to add a new cell, and let it ask your for the cell.
Instead, you should duplicate the
data your data source delegate's -cellForRowAtIndexPath method uses to create the cell you want to copy, and then call insertRowsAtIndexPaths:withRowAnimation: to tell the table view that you are adding extra cells for your table view.
The table view will then call -cellForRowAtIndexPath for the cell you just created, and you create/dequeue a new cell at that point and fill it with the data you duplicated.
Regards,
Duncan C