這個(gè)只是在section為一的情況雪猪。思路就是把需要加在section的View 加到 mj_footer上乏奥。
具體如下 需要更改mj原本的大小嬉挡。
UIView *view = [[UIView alloc]init];
view.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH , 12);
view.backgroundColor = GetColor(242, 243, 244, 1);
[_tableView.mj_footer addSubview:view];
CGRect rect = _tableView.mj_footer.frame;
rect.size.height = 66;
_tableView.mj_footer.frame = rect;
正常情況下的代碼
//設(shè)置Footer的高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 12;
}
//配置View
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *view = [[UIView alloc]init];
view.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH, 12);
view.backgroundColor = GetColor(242, 243, 244, 1);
return view;
/*
首先在初始化的時(shí)候:
[_tableView registerClass:[FooterView class] forHeaderFooterViewReuseIdentifier:@"footerView"];
然后再在這個(gè)里面:
HeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"footerView"];
FooterView 是繼承于UITableViewHeaderFooterView的
*/
}
如果section多的話丰泊,可以嘗試兩種結(jié)合 贾铝。(我沒試過隙轻,當(dāng)然以此類推Header沖突的時(shí)候是否可以這樣呢!)