当我向下滚动我的UIRefreshControl
时,我的collectionview
无法正常工作。 refreshControl
即使轻微滚动也会弹出,导致标题跳了一下。
我尝试过:
extendedLayoutIncludesOpaqueBars = true
这样可以修复某些内容,但在向下滚动以进行刷新控制时仍会进行一次小跳转(几乎无法察觉)。如果我做prefersLargeTitles = false
,它工作正常,没有跳跃。
我花了好几个小时试图修复它,这要归功于UIRefreshControl
上糟糕的Apple文档,但终于找到了解决方案。你必须在refreshControl
方法中添加你的viewDidAppear
,我在viewDidLoad
方法中添加它:
override func viewDidAappear(_ animated: Bool) {
super.viewDidAppear(animated)
collectionView.refreshControl = refreshControl
}