UITableView中替代单元格的高度不同 [英] Different height for alternative cell in UITableView

查看:120
本文介绍了UITableView中替代单元格的高度不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作一个不同高度的备用单元格?

How to make a alternate cell with a different height?

我需要cell1的高度为60,cell2为30 ....

I need height for cell1 is 60 and cell2 is 30....

我该怎么做?

提前致谢。

推荐答案

你可以从表视图的委托方法设置单元格的高度

you can set the height of cell from the delegate method of table view

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     if (indexPath.row==0)
     {
        return 60;
     }
     else if(indexPath.row==1)
     {
        return 20;
     }
}

依旧......

快乐编码....

这篇关于UITableView中替代单元格的高度不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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