美文网首页
UITableView在使用MJRefresh刷新回不到首页的情

UITableView在使用MJRefresh刷新回不到首页的情

作者: ZhangCB | 来源:发表于2018-07-07 09:45 被阅读0次

前段时间碰到一个需求,就是UITableView头部有一些类型可以选择,选择不同的类型,UITableView上显示对应的数据,重点来了,但是选择不同类型后,UITableView必须回到最顶部,然后在刷新。自己试了下在iOS11以前都没问题,但是到了iOS11就会出现UITableView乱跳的情况,找了很久,终于知道了。

Self-Sizing在iOS11下是默认开启的,Headers, footers, cells都默认开启Self-Sizing,所有estimated 高度默认值从iOS11之前的 0 改变为UITableViewAutomaticDimension。

所以你只要在Appdelegate.m文件中添加下面几行代码即可。

if (@available(iOS11.0, *)) {

     UITableView.appearance.estimatedRowHeight=0;

     UITableView.appearance.estimatedSectionFooterHeight=0;

     UITableView.appearance.estimatedSectionHeaderHeight=0;

}

相关文章

网友评论

      本文标题:UITableView在使用MJRefresh刷新回不到首页的情

      本文链接:https://www.haomeiwen.com/subject/higiuftx.html