ipad开发,在实现一个UITableView多个section的时候,给每个sction赋值headTitle的时候,老师赋值两边,如上图所示.
1.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
NSString *str;
if(section==0)
{
str=@"网站子站点";
}
if(section==1)
{
str=@"列表库";
}
return str;
}
2.//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//{
// UIView *viewSection=nil;
// if(section==0)
// {
// //viewSection = [[UIView alloc] initWithFrame:CGRectMake(10, 0, 300, 20)];
// viewSection = [[UIView alloc] init];
// viewSection.backgroundColor=[UIColor clearColor];
//// UILabel *textSection = [[UILabel alloc] initWithFrame:CGRectMake(10,2, 140, 20)];
//// //textSection.text = @"网站工作区";
//// textSection.textColor =[UIColor clearColor];
//// textSection.backgroundColor = [UIColor clearColor];
//// textSection.font = [UIFont systemFontOfSize:20.0f];
//// [viewSection addSubview:textSection];
//// [textSection release];
//
// }
// if(section==1)
// {
// viewSection = [[UIView alloc] init];
// viewSection.backgroundColor=[UIColor clearColor];
//// UILabel *textSection = [[UILabel alloc] initWithFrame:CGRectMake(10,2, 140, 20)];
//// //textSection.text = @"列表库";
//// textSection.textColor =[UIColor redColor];
//// textSection.backgroundColor = [UIColor clearColor];
//// textSection.font = [UIFont systemFontOfSize:20.0f];
//// [viewSection addSubview:textSection];
//// [textSection release];
//
// }
// return [viewSection autorelease];
//}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货