gpt4 book ai didi

objective-c - 在 uitableviewcell 中制作一个 "load more"按钮?

转载 作者:太空狗 更新时间:2023-10-30 03:21:17 25 4
gpt4 key购买 nike

嘿,任何人都可以指导我完成这个我在表中有大约 15 个条目我想要另外 15 个在最后一个 UITableViewCell 中提出更多负载。谁能帮帮我?

最佳答案

在 tableview 中显示一个额外的行,在

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return dataRows+1;
}

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

//after setting tableviewcell

if(indexPath.row==dataRows){

cell.textLabel.text=@"Load More Rows";
}
}

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

if(indexPath.row==dataRows){
//there you can write code to get next rows
}
}

您需要根据显示的行数更新 numberOfRows 变量。

编辑:获取额外条目后,您可以使用以下方法将它们添加到现有条目数组中。您的原始数组应该是 NSMutableArray 才能使用此方法。

[originalEntriesArray addObjectsFromArray:extraEntriesArray];

关于objective-c - 在 uitableviewcell 中制作一个 "load more"按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6159844/

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