[英]is it possible to change UITableView section title background color
作为标题,可以做到吗?
You will need to use 你需要使用
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 30;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *v = [[UIView alloc] init];
[v setBackgroundColor:[UIColor blackColor]];
return [v autorelease];
}
This was free-handed so forgive any typos, etc.. 这是自由的,所以请原谅任何错别字等。
UPDATE: This only works for 'grouped' tables. 更新:这仅适用于“分组”表。 Is your table grouped, or normal?
您的表格是分组还是正常?
Yes. 是。 Customize the HeaderInSection using the method in UITableViewDelegate Protocol:
使用UITableViewDelegate协议中的方法自定义HeaderInSection:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
As it returns a UIView, you can set it to anything you like or just 当它返回UIView时,您可以将其设置为您喜欢或只是的任何内容
[UIView setBackgroundColor:UIColor];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.