Moving cell only on first position


#1

Hi there,

hope i get some answers here. When im in editing mode to move cells, i can only move cell a little bit and then it will jumps automaticly on first position of the table.

I don’t know if it is correct, but it looks wrong.


#2

I’ve solved the problem today. Found the issue in 11.2 guess the chapter called “adding new rows” or something like this (i have the german translation of the book).

my code for adding a new Row was the follow:

- (IBAcion)addNewPossession:(id)sender
{
[[PossessionStore defaultStore] createPossession];
[[self tableView] reloadData];
}

I have a look in the example code of your projects and find this:

[code]- (IBAction)addNewPossession:(id)sender
{
Possession *newItem = [[PossessionStore defaultStore] createPossession];
int lastRow = [[[PossessionStore defaultStore] allPossessions] indexOfObject:newItem];

NSIndexPath *ip = [NSIndexPath indexPathForRow:lastRow inSection:0];
[[self tableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:ip]
                        withRowAnimation:UITableViewRowAnimationTop];

}[/code]
Note: The Possession-Variables are named BNRItem in the example Code of your projects …

This solved my problem, now the rows will be insert with animation and i can move it to the position i like (how it should work).