<分区>
Possible Duplicate:
TableView Footer is scrolling with the table
我希望每个部分都有一个页脚,它不会粘住并且会随着表格滚动
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
此方法为页脚定义了一个“粘性” View 。
提前致谢
<分区>
Possible Duplicate:
TableView Footer is scrolling with the table
我希望每个部分都有一个页脚,它不会粘住并且会随着表格滚动
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
此方法为页脚定义了一个“粘性” View 。
提前致谢
最佳答案
假设您有一种方法可以知道您何时位于特定部分的数据集的末尾,为什么不直接标记显示为您想要节页脚吗?在 tableView:cellForRowAtIndexPath:
中编写逻辑非常简单,该逻辑将检查所请求的单元格是否在该特定部分的数据集中。一旦请求的 indexPath.row
比可用数据大 1(通常包含在数组中,因此如果 indexPath.row 等于 [array count]
) ,返回您的“页脚”单元格。这将在滚动时与表格一起滚动,因为它只是另一个单元格。您可以根据需要使它看起来与常规单元格不同。
此外,您需要告诉您的 TableView 每个部分将有一个额外的行,所以如果您说类似的话
return [array count];
你需要说,而不是,
return [array count] + 1;
在您的 numberOfRowsInSection 方法中。
关于iphone - 如何使部分的 UITableView 页脚不粘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9999785/
相关文章:
iphone - iOS支持什么电话://file handling?
iphone - 核心数据顺序 : Can I use a float?
ios - 为什么这个 UILabel 没有显示在 SKScene 中?
ios - 像 WhatsApp 一样,iPhone 锁定时如何添加通知标题?
ios - 我应该在 firebase 中使用查询还是使用 observe 函数?
iphone - stringByReplacingOccurrencesOfString小写和大写的字符串Objective-C
iphone - 使用 scandit sdk 的条码读取器