iOS11 分页滚动视图突然可以垂直滚动

iOS11 paged scroll view suddenly is scrollable vertically

我有一个使用 EMPageViewController 来显示一组入门幻灯片的应用程序。我的理解是底层滚动视图是使用分页模式显示幻灯片。

更新到iOS11后,我发现幻灯片突然跟随手指移动,因此可以拖动并上下弹跳。我希望分页滚动视图只能水平滚动。

如何在 iOS11 中将分页滚动视图限制为仅水平滚动?

我试过了,但没用

 pageViewController.scrollView.alwaysBounceVertical = false

这解决了问题:

if #available(iOS 11.0, *)
{
    self.scrollView.contentInsetAdjustmentBehavior = .never
}

The behavior for determining the adjusted content offsets. This property specifies how the safe area insets are used to modify the content area of the scroll view.

contentInsetAdjustmentBehavior 是 iOS 11 > 的新增功能,默认值为自动。

Content is always adjusted vertically when the scroll view is the content view of a view controller that is currently displayed by a navigation or tab bar controller. If the scroll view is horizontally scrollable, the horizontal content offset is also adjusted when there are nonzero safe area insets.

这使得我的一些 UIScrollView 滚动得比它们被排除的更多。