UITableView常用的数据源方法和委托方法
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *headerView=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)] autorelease]; headerView.backgroundColor=[UIColor yellowColor]; UILabel *label=[[[UILabel alloc] initWithFrame:CGRectMake(20, 20, 300, 30)] autorelease]; label.text=@"header"; [headerView addSubview:label]; return headerView;}- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ UIView *headerView=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)] autorelease]; headerView.backgroundColor=[UIColor redColor]; UILabel *label=[[[UILabel alloc] initWithFrame:CGRectMake(20, 20, 300, 30)] autorelease]; label.text=@"foot"; [headerView addSubview:label]; return headerView;}