ios11以后 列表跳转偏移的bug

在使用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)