开发者

tableView:moveRowAtIndexPath:toIndexPath: on iOS 3.x gets called over and over again when moving rows

As the topic says, this method gets called over and over again when I move rows and crashes. It works fine on iOS 4.x

- (void)tableView:(UITableView *)tableView moveRo开发者_JS百科wAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
  NSUInteger fromRow = [fromIndexPath row];
  NSUInteger toRow = [toIndexPath row];
  id object = [[array objectAtIndex:fromRow] retain];
  [array removeObjectAtIndex:fromRow];
  [array insertObject:object atIndex:toRow];
  [object release];
  [self reloadTableView];
}

-(void)reloadTableView{
 [myTableView reloadData];
}

I don't have any idea why. Please help.


You don't need:

[self reloadTableView];

...or:

[myTableView reloadData];

If you have to reload, do this:

[myTableView performSelector:@selector(reloadData) withObject:nil afterDelay:1.0];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜