【发布时间】:2011-04-27 09:38:22
【问题描述】:
我有一个带有 tableHeaderView 的简单 uitableview。我有不止一个部分。
我将 headerview 的高度设置为 30。但我想在我的 header 中使用 40 像素高度的 uiview(从 0,0 到 320,30 不透明。从 30,10 到 320,40 是透明的)。我在里面放了一张照片。点(0x30)上有一个小图标。它的高度= 10。 我只想在第一个表格单元格上显示我的 headerview。
您将在下面看到我将标题的高度设置为 30,但我在 viewForHeaderInSection 中创建了 40 像素高度的视图。
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 30;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
sectionView.backgroundColor = [UIColor redColor];
[sectionView autorelease];
return sectionView;
}
有可能吗?
【问题讨论】:
标签: iphone uitableview header