gpt4 book ai didi

iphone - 表格 View 单元格随文本大小展开或收缩

转载 作者:行者123 更新时间:2023-11-28 23:02:17 24 4
gpt4 key购买 nike

我一直在用从数据库中获取的数据填充 UITable View 单元格。不同单元格的数据长度不同。所以我需要根据数据长度扩展或收缩高度。目前,我正在使用带有以下代码的自定义单元格

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *cellID= @"customcell4fan";
customcell4fan *cell = (customcell4fan *)[tableView dequeueReusableCellWithIdentifier:cellID];

if(cell==nil)
{
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"customcell4fan" owner:nil options:nil];

for(id currentObject in nibObjects)
{
if([currentObject isKindOfClass: [customcell4fan class]])
{
cell = (customcell4fan *)currentObject;
}

}
}

eleme = [xmlElementObjects objectAtIndex:indexPath.section];

NSString *email= [eleme.title stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \n\t"]];
NSString *postData= [eleme.description stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \n\t"]];
cell.nameLabel.text=email;
cell.postLabel.text=postData;

return cell;

}

最佳答案

关于iphone - 表格 View 单元格随文本大小展开或收缩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9834423/

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