gpt4 book ai didi

iphone - 索引 0 大小的 UITableView 单元格

转载 作者:行者123 更新时间:2023-11-28 19:20:32 25 4
gpt4 key购买 nike

自定义表格中第一个单元格以像 Netflix 应用程序一样显示(即更大/不同)的最佳方法是什么?为了以后使用方便,要求我尽量使用IB,方便以后编辑。

这是一张 Netflix table 的照片。 http://cl.ly/3j1d473d1j160502160t

最佳答案

使用表头 View 。将 View 拖到 TableView 的顶部,它将成为“表头 View ”。

如果您有其他基本不变的“单元格”(并且可能会打开/关闭),您可以考虑将 UITableViewCell 对象放入您的 xib 中,并从 tableView 返回它们:cellForRowAtIndexPath: 委托(delegate)方法。同时实现 tableView:heightForRowAtIndexPath: 方法。

两者可以有相同的大纲,比如:

-(UITableViewCell*)tableView:(UITableView*)tv cellForRowAtIndexPath:(NSIndexPath*)ip
{
if ( ip.section==0 ) return headerCell;
// ...handle regular cells
}

-(CGFloat)tableView:(UITableView*)tv heightForRowAtIndexPath:(NSIndexPath*)ip
{
if ( ip.section==0 ) return headerCell.frame.size.height;
// ...handle regular cells
return 44;
}

关于iphone - 索引 0 大小的 UITableView 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9269344/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com