【发布时间】:2010-03-16 06:58:43
【问题描述】:
我试图覆盖第二个 tableHeaderView。但是似乎heightForHeaderInSection方法中它的高度似乎为0。无法解释,我是否必须将其放入iVar中,因为在viewForHeaderInSection中我可以毫无问题地设置视图。
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(section == 0)
return @"Adding a new list";
else
return @"Other lists";
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if(section == 0) {
return tableView.tableHeaderView;
} else {
UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 50)] autorelease];
view.backgroundColor = [UIColor redColor];
return view;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
if(section == 0)
return tableView.tableHeaderView.frame.size.height;
else
return 30;
}
【问题讨论】:
标签: iphone uitableview grouped-table