Monday, 19 August 2013

UITableView disable drag function for concrete cell

UITableView disable drag function for concrete cell

I need to disable drag function for concrete UITableView cell.
I have implemented this code:
- (BOOL)tableView:(UITableView *)tableView
canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
if (cell.editing) {
return YES;
} else {
return NO;
}
}
For set editing I use this:
[cell setEditing:YES animated:YES];
or this
[cell setEditing:NO animated:YES];
In some case my cell can be edited or no.
So the problem that UITableViewCell *cell = [_tableView
cellForRowAtIndexPath:indexPath]; shows the 0x0000000 in the log. But I
think it should refers to appropriate cell in table view.
Alos maybe there is other solution how to crete it.
I setup in init this code
[_tableView setEditing:YES animated:YES];
I suppose it will set all cells with editing = YES. But it does not work.

No comments:

Post a Comment