UITableView SectionFooter 与 MJRefresh footer 冲突解决

这个只是在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;

正常情况下的代码


//设置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;

/*

首先在初始化的时候:

[_tableView registerClass:[FooterView class] forHeaderFooterViewReuseIdentifier:@"footerView"];

然后再在这个里面:

HeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"footerView"];


FooterView 是继承于UITableViewHeaderFooterView的

*/

}

如果section多的话,可以尝试两种结合 。(我没试过,当然以此类推Header冲突的时候是否可以这样呢!)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 版权声明:未经本人允许,禁止转载. 1. TableView初始化 1.UITableView有两种风格:UITa...
    萧雪痕阅读 2,921评论 2 10
  • 实现原理在tableView上加上一个View,注意不是headerView,而是一个Y值为负数的普通View,下...
    ScaryMonsterLyn阅读 745评论 0 2
  • 1.badgeVaule气泡提示 2.git终端命令方法> pwd查看全部 >cd>ls >之后桌面找到文件夹内容...
    i得深刻方得S阅读 4,805评论 1 9
  • OC的动态性:会把编译和链接是需要执行的逻辑延迟到运行时,例如使用 id 所修饰的变量会在运行的时候才确定具体类型...
    allen852阅读 695评论 0 1
  • 又见流年秋一场 叶坠风衣裳 想蒹葭苍苍 亦成枯原 伊人在何方 怅望处十年寒窗 夜至华灯上 孤影伴灯旁 花开雪上 无...
    向鹤居士阅读 420评论 8 9