问题在于,如果您的视图大小比导航控制器视图大小要小,则在双倍速度的情况下会出现问题。
因此,在滚动视图时,内容偏移量的变化会导致视图框架发生变化,并且它的速度也会加倍。
那就可以解释这种行为了。请尝试以下步骤来解决问题。
extendedLayoutIncludesOpaqueBars = true
您应该将此行添加到您的UIViewController
、UITableViewController
或UICollectionViewController
中。
if #available(iOS 11.0, *) {
searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true
}
self.navigationController?.setNavigationBarHidden(true, animated: animated)
print(view.safeAreaInsets)
吗? - Vini App