UITableView cell update issue for reordering

Some help would be greatly appreciated here!

I have a custom UITableView cell consisting of an image (green, orange or red) and two labels with different font sizes. UITableView is controlled by NSMutableArray objects.

UITableView is divided into three sections: the first section contains all the cells with a red image, the second section with orange, the third section with green.

I implemented the ability to reorder cells in a UITableView, allowing the user to drag, say, an element with a red image from the red section into the orange section. This drag and drop works great and the underlying data is updated correctly. I know that this is so, because if I select a cell, I will go to its detailed view and the data will be updated.

However, the UITableView is not updated until I go into the details (or remove the application) and come back! It also updates if I scroll back to the offending cell and see it in mind again, so the array clearly contains the correct data. I just can’t invoke a view update!

I tried the following after my code to change the underlying data in moveRowAtIndexPath:

[self.tableView reloadData];

. Apple Language Reference , reloadData , , , , . ,

[self setNeedsDisplay];

( ).

, UITableView? afterMoveHasBeenCompleted: - , , reloadData moveRowAtIndexPath: ?!

+5
2

!

, , , .

reloadData :

- (void)refreshDisplay:(UITableView *)tableView {
[tableView reloadData]; }

​​0,5 :

[self performSelector:(@selector(refreshDisplay:)) withObject:(tableView) afterDelay:0.5];

! 0,5 .

, - !

+4

UITableViewDelegate. UITableView , , - . ,

tableView:didEndEditingRowAtIndexPath:
tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:
.
+2

All Articles