我想在滚动时让我的第一个单元格始终位于 tableview 的顶部。
任何帮助都是可观的。提前致谢...
最佳答案
这是为 UITableView 创建标题 View 的方法
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) section {
UIView *sectionHeaderView = [[UIView alloc] initWithFrame:
CGRectMake(0, 0,tableView.frame.size.width, 40.0)];
// Customize it as per your design
return sectionHeaderView;
}
现在返回
的高度- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//return the desirable height
return 40;
}
希望对你有帮助。
关于ios - 如何在滚动 TableView 期间始终将 TableView 的第一个单元格保持在其 TableView 的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32201493/