NSIndexPath *indexPath = [self.tableView indexPathForCell:self.amountCell];
在这句话后面打印对象,看起来除了indexPath 找不出来,其他的都在,就是找不到cell的位置
========== self.tableView ============== <UITableView: 0x102acee00; frame = (0 0; 320 504); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x283832be0>; layer = <CAGradientLayer: 0x28372d5a0>; contentOffset: {0, 0}; contentSize: {320, 425}; adjustedContentInset: {0, 0, 0, 0}>
========== self.amountCell ============== <BSAmountCell: 0x103323e00; baseClass = UITableViewCell; frame = (0 171; 320 72); hidden = YES; autoresize = W; layer = <CAGradientLayer: 0x2837852a0>>
========== indexPath ============== (null)
========== self.tableView.visibleCells ============== (
"<BSPayWayInfoCell: 0x1032bc600; baseClass = UITableViewCell; frame = (0 48; 320 65); autoresize = W; layer = <CAGradientLayer: 0x2837876a0>>",
"<BSAmountCell: 0x103323e00; baseClass = UITableViewCell; frame = (0 171; 320 72); autoresize = W; layer = <CAGradientLayer: 0x2837852a0>>",
"<BSWarningTextCell: 0x103334200; baseClass = UITableViewCell; frame = (0 243; 320 1.19209e-07); autoresize = W; layer = <CAGradientLayer: 0x2837af560>>",
"<BSWithdrawWaysCell: 0x103337000; baseClass = UITableViewCell; frame = (0 301; 320 112); autoresize = W; layer = <CAGradientLayer: 0x2837238c0>>",
"<BSWithdrawWaysCell: 0x10335ac00; baseClass = UITableViewCell; frame = (0 413; 320 82); autoresize = W; layer = <CAGradientLayer: 0x28373dc40>>"
)
按道理系统方法可以得到indexPath不为空的。但是因为前面有刷新整个tableView的,所以这里可能会有时间差的问题,也许是系统的bug
所以这个 indexPath 为空,以下这句代码执行就会崩溃~~
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
网友评论