好吧我很确定这种方法一直执行到现在为止我的UITableViewController
。我有打印语句在我的方法,像这样:heightForRowAtIndexPath永远不会被调用iOS9
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//455(PERFECT MIN HEIGHT) 475 is perfect spacing. 15.5 is the scalar for when descriptionLabel expands lines
return 475;
NSLog(@"ISSSS ITTT ONNNN???");
if (currentDescriptionHeight == 16.0) {
NSLog(@"OHHH so it triggered 1111");
return 475;
}else if (currentDescriptionHeight == 31.5){
NSLog(@"OHHH so it triggered 2222");
return 490.5;
}else if (currentDescriptionHeight == 47){
NSLog(@"OHHH so it triggered 3333");
return 506;
}
//475 - 1 line description,
}
我抄法头到我.H文件,并正确设置了代表团:在我viewDidLoad:
方法
self.tableView.delegate = self;
self.tableView.dataSource = self;
。为什么我的heightForRowAtIndexPath
根本不被调用?
为什么你还要在函数的开始return语句? – Fonix
Uhm,如果只有条件中没有返回,则方法错误? – Chisx
返回语句立即结束函数,因此它下面的代码将永远不会执行 – Fonix