【发布时间】:2018-05-21 14:54:09
【问题描述】:
标题很拗口,但这就是正在发生的事情。在 iOS 11 中,当您有一个带有大标题的导航栏时,您向下滚动一条路径并点击状态栏,它将滚动到顶部。当它滚动到顶部时,它会卡住滚动过去顶部。
它看起来超级混乱,这是滚动到顶部后的示例。它滚动到现在开始拉刷新控制!
有没有人看到这个并能够修复它?邮件标题很大,没有问题,虽然它可能不是UICollectionView
就代码而言,它尽可能简单:
extension ViewController: UICollectionViewDataSource {
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 100
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "fakeCell", for: indexPath) as? UICollectionViewCell
cell?.backgroundColor = [UIColor.black, .blue, .red, .green, .yellow][indexPath.row % 5]
return cell!
}
}
【问题讨论】:
-
我认为上面是普通代码,但可能仍然值得展示。
-
尝试从 scrollViewShouldScrollToTop: 返回
false并在其中放入您自己的滚动到顶部代码。
标签: ios uicollectionview uikit ios11