答案 0 :(得分:0)
1.您可以在此UITableViewDelegate
的函数中返回标题视图。
optional public func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
// custom view for header. will be adjusted to default or specified header height
2.您可以以编程方式添加该行,或尝试将表格视图的样式设置为Plain
。
答案 1 :(得分:0)
在viewForHeaderInSection中播放自定义视图
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
/// create your custom view//
return customView;
}
答案 2 :(得分:0)
1.创建您想要的自定义视图(如您发布的图像)
2.将该视图作为此方法中节的标题返回
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
答案 3 :(得分:0)
使用此委托方法。
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *headerView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, HEADER_H)];
UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(0, HEADER_H-2, tableView.frame.size.width, 1)];
lineView.backgroundColor=[UIColor darkGrayColor];
[headerView addSubview:lineView];
return headerView;
}