Reputation: 18498
Could someone please point me in the right direction on how to allow the cells to be able to move in a UITableView
?
At the moment when I click and hold and then drag below the second cell it doesn't move. It just drags all the cells with it and stretches back up again.
I would like to be able to move the cells so I can basically rearrange the cells during runtime. can someone please help me.
Upvotes: 0
Views: 2153
Reputation: 2221
You can only rearrange tableview cells when in edit mode.
look for this line of code within your program :
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
self.navigationItem.rightBarButtonItem = self.editButtonItem;
It should be commented if you haven't touched it yet.
cheers !
Kyle
Upvotes: 2
Reputation: 2139
Try this
- (void) tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)fromIndexPath
toIndexPath:(NSIndexPath *)toIndexPath
Upvotes: 1
Reputation: 34935
This is functionality that the UITableView
provides for you.
Check the Managing the Reordering of Rows section in the TableView Programming Guide.
Upvotes: 3