2013-05-09 18 views
1

我有一个UITableView。当用户点击Edit(位于例如对项目进行排序)我在UITable视图,完成按钮,删除效果

- (void)setEditing:(BOOL)editing animated:(BOOL)animate { 

进入但当用户完成(和点击完成的),还有一个动画。我如何删除似乎重新加载单元格的动画。

感谢

编辑:只是想出了这个方法又被称为

- (void)controller:(NSFetchedResultsController *)controller 
    didChangeObject:(id)anObject 
     atIndexPath:(NSIndexPath *)indexPath 
    forChangeType:(NSFetchedResultsChangeType)type 
     newIndexPath:(NSIndexPath *)newIndexPath { 

是有办法去掉这个调用?

回答

0

使用这种方式:

- (void)setEditing:(BOOL)editing animated:(BOOL)animate { 
    if(editing) 
     [super setEditing:editing animated:YES]; 
    else 
     [super setEditing:editing animated:NO; 
} 
+0

感谢的点击呼叫功能,但我的意思是它出现的编辑不上单击编辑按钮后,动画,但点击完成按钮 – Max 2013-05-09 06:27:51

+0

看到我编辑的答案 – Anil 2013-05-09 06:34:07

+0

erf,它不起作用 – Max 2013-05-09 06:38:04

0

不能删除。当表视图进入并退出编辑模式时,tableView将自动重新加载可见单元格。这实际上是一个可接受的行为编辑模式应该改变tabelView单元格中的内容(插入或删除单元格或编辑一些值)。所以为了反映你需要重新加载这些单元的变化。 TableView将为您完成这项工作。它会调用cellForRowAtIndexPath的可见单元格

+0

谢谢,我刚编辑我的问题 – Max 2013-05-09 06:49:16

0

这个添加到你做

NSInteger rows; 
rows = [self tableView:tableView numberOfRowsInSection:section]; 

for (int i=0; i<rows; i++) 
{ 
NSIndexPath *tmpIndexPath = [NSIndexPath indexPathForRow:i inSection:section]; 
[tmpArray addObject:tmpIndexPath]; 
} 

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 
[tableView insertRowsAtIndexPaths:tmpArray withRowAnimation:UITableViewRowAnimationNone];