很简单的一段代码
在UITableViewDelegate回调中
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 30)] autorelease];
if (section == integerRepresentingYourSectionOfInterest)
[headerView setBackgroundColor:[UIColor redColor]];
else
[headerView setBackgroundColor:[UIColor clearColor]];
return headerView;
}小地方,自己mark下。
UITableView头部视图设置
本文介绍了一段简单的UITableViewDelegate回调代码,用于根据不同的section为UITableView的头部视图设置背景颜色。当section符合特定条件时,头部视图背景设为红色;否则设为透明。
1048

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



