- UITableView reloadData 后 content
- UITableView reloadData 后 content
- UITableView,UICollectionView判断re
- UITableView 监听 reloaddata 结束的两种常
- UITableView 在请求数据后调用reloadData只走
- UITableView reloadData或者reloadS
- 话说 UITableView 的坑
- iOS UITableView reloadData数据窜行问题
- UITableView reloadData异步刷新问题
- iOS开发 -- UITableview reloadData后
原因
UITableView 在初始加载数据时,是通过估算得到的 contentSize,其中
estimatedRowHeight
、estimatedSectionFooterHeight
、estimatedSectionHeaderHeight
的值均为 automaticDimension
解决
- 首先将这几个值设为 0
由于reloadData 是异步执行,因此想要在 reloadData 后获取执行部分操作,需要通过以下两种方式 - 如果是 iOS 11之后,直接调用
performBatchUpdates
方法 - iOS 11之前在主线程中设置contentOffset,当然这种方式不一定准确
DispatchQueue.main.async { self.storeTable.contentOffset = CGPoint(x: 0, y: offsetY) }
网友评论