(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 50;
}(UIView )tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section{
UIView *cusheadView = [[UIView alloc]initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, 50)];
cusheadView.backgroundColor = [UIColor greenColor];
return cusheadView;
}
设置headView需要两个函数
最新推荐文章于 2024-09-28 23:59:47 发布
本文介绍了如何使用Swift为UITableView设置头部视图的高度及颜色。通过实现tableView(_:heightForHeaderInSection:)和tableView(_:viewForHeaderInSection:)方法,可以自定义UITableView每个部分头部的高度及显示样式。
1232

被折叠的 条评论
为什么被折叠?



