tableView单元格高度...如何自定义? [英] tableView cell height... how to customize it?

查看:122
本文介绍了tableView单元格高度...如何自定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在分组表视图中修改一个单元格的高度?

我有一个包含3个和2个行的2个部分的表格视图...我会更改第二个行的高度第二部分的一行...

Is it possible to modify height of only one cell in a grouped table view?
I have a table view with 2 sections of 3 and 2 rows... I would change row height of the second row of the second section...

我该怎么做?

谢谢!

How can I do this?
Thanks!

推荐答案

你可以看一下这个方法:

You can look at this method:

- (CGFloat)tableView:(UITableView * )tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

在您的情况下,代码应如下所示:

In your case, the code should look like:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
   if (indexPath.section == 1 && indexPath.row == 1) {
      return SPECIAL_HEIGHT;
   }
   return NORMAL_HEIGHT;
}

您可以查找有关这里的方法

这篇关于tableView单元格高度...如何自定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆