我有一个表格视图,其中包含多个原型单元格,我在storyboard中设计了它们,但是我在高度方面遇到了问题,因为我的第一个单元格应该与第二个不同,以此类推...我为每个单元格都有不同的标识符,并且由于我在storyboard中设计了它们,所以我知道它们的高度。我在代码中使用了以下内容,但它没有起作用,请问有人知道如何解决吗?:
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [[UITableViewCell alloc]init];
switch (indexPath.section)
{
case 1:
cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
return 743.0f;
break;
case 2:
cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];
return 300.0f;
}
感谢您抽出时间。