What is the meaning of the “no index path for table cell being reused” message in iOS 6/7?

前端 未结 14 2305
一整个雨季
一整个雨季 2020-11-27 15:12

Since starting to compile my app with iOS 6 (and since also iOS 7) I\'ve started seeing this message. I know that the way that UITableViews go about managing cells is diffe

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-27 15:43

    Maybe this helps someone: i once had this error while refreshing a single table view cell. I meant to do something like

    NSIndexPath *reloadRow = [NSIndexPath indexPathForRow:1 inSection:2];
    [self._mainTableView reloadRowsAtIndexPaths:@[reloadWebViewRow]
                               withRowAnimation:UITableViewRowAnimationFade];
    

    But accidentally, i typed

    NSIndexPath *reloadRow = [NSIndexPath indexPathForItem:1 inSection:2];
    

    Notice the difference of the two indexpaths: one is created with indexPathForItem (wrong), the other with indexPathForRow (correct). This all resulted in very strange behaviour of the tableView and the error message in the headline.

提交回复
热议问题