문제

I implemented the commitEditingStyle method to delete a row from my tableview. If I simply put [timersArray removeObjectAtIndex:indexPath.row] the row deletes just fine. The only problem is that it does not animate so I tried putting this:

[self->tableView beginUpdates];
[self->tableView deleteRowsAtIndexPaths:timersArray withRowAnimation:UITableViewRowAnimationBottom];
[self->tableView endUpdates];

but when I try and delete something it brings up this:

'NSInvalidArgumentException', reason: '-[Timer row]: unrecognized selector sent to instance 0x17ed37b0'

I thought it was because the timersArray is a NSMuttableArray and not a NSArray but that did not change anything. Can someone help me find out how to fix this? Anything will help. Thanks!

도움이 되었습니까?

해결책

I fixed the issue by adding [NSArray arrayWithObject:indexPath] in place of timersArray in order for that to work I had to place the [timersArray removeRowAtIndex:indexPath.row] above the [self->tableView beginUpdates] and at that point it worked!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top