相关疑难解决方法(0)

tableView:indexPathForCell返回nil

我正在使用该方法tableView:indexPathForCell来实现自定义委托,该委托可以UITableViewCell根据其UIWebView内部的框架大小动态调整大小.问题是当我试图找出特定单元格的indexPath是什么时tableView:indexPathForCell返回nil:

- (void)trialSummaryTableViewCell:(TrialSummaryTableViewCell *)cell shouldAssignHeight:(CGFloat)newHeight {
    NSIndexPath *indexPath = [tableV indexPathForCell:cell];
    NSLog(@"tableV: %@\ncell: %@\nindexPath: %@", tableV, cell, indexPath); //<-- 
    // ...
}
Run Code Online (Sandbox Code Playgroud)

这里,tableV不返回nil,单元格不返回nil,但indexPath返回nil.

我究竟做错了什么?

编辑:我-(void)trialSummaryTableViewCell从该tableView:cellForRowAtIndexPath:方法调用

iphone protocols uiwebview uitableview

38
推荐指数
3
解决办法
2万
查看次数

标签 统计

iphone ×1

protocols ×1

uitableview ×1

uiwebview ×1