美文网首页
ios11以后 列表跳转偏移的bug

ios11以后 列表跳转偏移的bug

作者: 思考的小妮子 | 来源:发表于2018-07-09 16:48 被阅读25次

    在使用ios11 用tableview的方法跳转到响应section或row的时候,会发现第一次会偏移。

    [tableview scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:2] atScrollPosition:UITableViewScrollPositionTop animated:YES];

    但是在ios11之前,用模拟器测试了下,是不会有这种情况的,所以断定是苹果11以后的bug。

    解决方案如下,在初始化设置tableview的时候,

    self.table.estimatedRowHeight = 0;

    self.table.estimatedSectionHeaderHeight = 0;

    self.table.estimatedSectionFooterHeight = 0;

    都为0就可以了

    相关文章

      网友评论

          本文标题:ios11以后 列表跳转偏移的bug

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