making a quot;load morequot; button in uitableviewcell?(制作“加载更多uitableviewcell 中的按钮?)
问题描述
嘿,谁能指导我完成这个我在表中有大约 15 个条目我希望另外 15 个条目在最后一个 UITableViewCell 中提供更多负载.谁能帮帮我?
hey, Could any one guide me through this I have around 15 entries in table I would like another 15 to come up with the load more in last UITableViewCell. could anyone help me?
推荐答案
在tableview中显示一个额外的行,在
to show an extra row in the tableview, in
- (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 变量.
You need to update the numberOfRows variable according to the displayed rows.
获取额外条目后,您可以使用以下方法将它们添加到现有条目数组中.您的原始数组应该是 NSMutableArray
才能使用此方法.
After fetching the extra entries, you can add them to the existing entries array using the following method. Your original array should be a NSMutableArray
to use this method.
[originalEntriesArray addObjectsFromArray:extraEntriesArray];
这篇关于制作“加载更多"uitableviewcell 中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:制作“加载更多"uitableviewcell 中的按钮?


基础教程推荐
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01