尝试在 heightForRowAtIndexPath 委托(delegate)方法中访问 [tableView cellForRowAtIndexPath:indexPath] 时应用程序崩溃。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([tableView cellForRowAtIndexPath:indexPath] someBOOLProperty]) {
return kSomeHeight;
}
return kDefaultHeight;
}
最佳答案
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
我们没有
tableViewCell
调用上述方法时的对象。我认为使用 [
tableView cellForRowAtIndexPath:indexPath
] 上面的委托(delegate)是不正确的。
关于objective-c - 在 heightForRowAtIndexPath 委托(delegate)方法中访问 TableViewCell 时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8493794/