1.创建headerview(注意创建表头的代码一定要在布局tableview的代码之前调用)
-(void)setHeadView{
headView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, SP_W(80))];
/*
在headerview上添加相应的控件
*/
}
-(void)setFooterView {
footerView = [[UIView alloc] init];
footerView.frame = CGRectMake(0, 0, WIDTH, 115);
footerView.backgroundColor = [UIColor whiteColor];
//背景阴影
UILabel *cutLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 10)];
cutLabel.backgroundColor = BGCOLOR;
[footerView addSubview:cutLabel];
//年票抵扣
UILabel *yearLable = [[UILabel alloc] init];
yearLable.text = @"年票抵扣";
CGSize yearSize = [yearLable sizeThatFits:CGSizeMake(WIDTH, 25)];
yearLable.frame = CGRectMake(10, CGRectGetMaxY(cutLabel.frame) + 15, yearSize.width, 25);
yearLable.textColor = TEXTCOLOR;
yearLable.font = FONT(15);
[footerView addSubview:yearLable];
orderTab.tableHeaderView = headView; //表头
orderTab.tableFooterView = footerView; //表尾