Ios5 我可以在UITableView中自定义节标题吗?(字体、图像…)
我可以在UITableView中自定义节标题吗?(字体、图像…) 我想实现这样的目标: 可能吗? 我已经得到了我想要的手机,但不是片头。Ios5 我可以在UITableView中自定义节标题吗?(字体、图像…),ios5,uitableview,Ios5,Uitableview,我可以在UITableView中自定义节标题吗?(字体、图像…) 我想实现这样的目标: 可能吗? 我已经得到了我想要的手机,但不是片头。 谢谢。通过实现方法tableView:viewForHeaderInSection: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { // create and return a custom UIView to u
谢谢。通过实现方法
tableView:viewForHeaderInSection:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
// create and return a custom UIView to use for the section here
}
}谢谢你的回复,我会试试的。但是,我应该使用什么尺寸或高度?我必须通过代码创建它吗?我能用故事板吗?谢谢我找到了这张桌子视图:HeightforHeader章节:非常感谢。
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionName = nil;
switch (section) {
case 0:
sectionName = [NSString stringWithFormat:@"Header Text 1"];
break;
case 1:
sectionName = [NSString stringWithFormat:@"Header Text 2"];
break;
case 2:
sectionName = [NSString stringWithFormat:@"Header Text 3"];
break;
}
UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
sectionHeader.backgroundColor = [UIColor clearColor];
sectionHeader.font = [UIFont boldSystemFontOfSize:18];
sectionHeader.textColor = [UIColor whiteColor];
sectionHeader.text = sectionName;
return sectionHeader;