reloadRowsAtIndexPaths崩溃; reloadData工作

时间:2017-09-07 07:19:41

标签: ios objective-c xcode

当我尝试按如下方式重新加载几行时,我的应用程序崩溃了:

[tblView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];

但是,当我用以下代码替换行时,代码工作正常:

[tblView reloadData];

我得到的崩溃是

  
    

libc ++ abi.dylib:以NSException类型的未捕获异常终止

  

3 个答案:

答案 0 :(得分:0)

UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];

[CATransaction begin];
[CATransaction setAnimationDuration:0.3];

[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction 
functionWithControlPoints:0 :1.8 :0 :1]];

[self.menuCollectionView performBatchUpdates:^{
  [tblView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
} completion:^(BOOL finished) {
}];

[CATransaction commit];
[UIView commitAnimations];

答案 1 :(得分:0)

用作

 NSIndexPath* indexPath = [NSIndexPath indexPathForRow:2 inSection:0];

 NSArray* indexArray = [NSArray arrayWithObjects:indexPath, nil];

 [tblView  reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationFade];

答案 2 :(得分:0)

传递indexPath,如下所示。

{{ (post | async)?.id }}
{{ (post | async)?.title}}
{{ (post | async)?.content}}