1.取消cell点击变色
cell.selectionStyle = UITableViewCellSelectionStyleNone;
2.禁止边缘滑动(类似到顶端仍可拖动一小节)
talbeview.bounces = NO;
3.设置分界线颜色
tableView.separatorColor = [UIColor clearColor];//透明,达到没有分界线效果
4.标题
Label加载在View上 return View时 才能实现自定义Label的frame, return label不能改变frame
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *HeaderString = nil;
switch (section) {
case 0:
HeaderString=@"1";
break;
case 1:
HeaderString= @"2";
break;
default:
HeaderString= @"3";
break;
}
UIView *headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)] autorelease];
headerView.backgroundColor = [UIColor clearColor];
UILabel *HeaderLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 200, 40)];
HeaderLabel.backgroundColor = [UIColor clearColor];
HeaderLabel.font = [UIFont boldSystemFontOfSize:17];
HeaderLabel.textColor = [UIColor whiteColor];
HeaderLabel.text = HeaderString;
[headerView addSubview:HeaderLabel];
[HeaderLabel release];
return headerView;
}
同理:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section