gpt4 book ai didi

ios - interactivePopGestureRecognizer 的问题(导航 Controller 向后滑动)

转载 作者:行者123 更新时间:2023-12-01 16:34:14 24 4
gpt4 key购买 nike

我的第一个问题,请温柔...

如果我使用 UIPageViewControllerTransitionStylePageCurl,但不能使用 UIPageViewControllerTransitionStyleScroll,从页面 Controller 向后滑动可以正常工作。我不明白为什么它反对后者。有任何想法吗?

过渡风格取决于演示模式:

if (inPageCurlMode) {
// this swipes back fine
self.pageViewController = [[UIPageViewController alloc]
initWithTransitionStyle:
UIPageViewControllerTransitionStylePageCurl
navigationOrientation:
UIPageViewControllerNavigationOrientationHorizontal
options:nil];
}
else {
// this won't swipe back
self.pageViewController = [[UIPageViewController alloc]
initWithTransitionStyle:
UIPageViewControllerTransitionStyleScroll
navigationOrientation:
UIPageViewControllerNavigationOrientationHorizontal
options:nil];
}

最佳答案

以下在 UIPageViewController 子类中对我有用:

    override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

for subview in self.view.subviews {

if let scrollview = subview as? UIScrollView{

if let gestures = scrollview.gestureRecognizers{

for gesture in gestures {
gesture.require(toFail: self.navigationController!.interactivePopGestureRecognizer!)
}
}
}
}
}

确保 navigationController 可用,这就是我将它放入 的原因viewDidAppear()

关于ios - interactivePopGestureRecognizer 的问题(导航 Controller 向后滑动),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29698212/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com