【问题标题】:UIControl tracking and iOS 13 presentation style cards not working togetherUIControl 跟踪和 iOS 13 演示样式卡不能一起工作
【发布时间】:2021-02-09 16:59:53
【问题描述】:

我正在使用AORangeSlider,它是UIControl 的子类,它覆盖了beginTracking、continueTracking 和endTracking 方法。

当这个控件被添加到一个viewController,它在iOS 13 中使用“卡片样式”呈现时,它的行为非常奇怪。滑动控件时,viewController 将尝试向下滑动,它会中断滑块行为并使其不可靠且无法正常工作。

如果我改为显示viewController 和UIModalPresentationFullScreen,则控件可以正常工作。

有没有办法让 AORangeSlider/UIControl 与 iOS 13 卡片样式一起使用,并且不会发生触摸事件冲突?

【问题讨论】:

  • 听起来这个控件可能有问题,因为普通滑块没有这个问题。如果您无法通过干预控件的代码来修复它,您可以关闭呈现视图的向下滑动手势。

标签: ios ios13 uicontrol


【解决方案1】:

不得不向 Apple 询问这个问题,他们推荐了以下解决方案,该解决方案很有效:

if (@available(iOS 13.0, *)) {
    
    for (UIGestureRecognizer *gestureRecognizer in self.navigationController.presentationController.presentedView.gestureRecognizers) {
        gestureRecognizer.enabled = NO;
    }
    
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 2020-02-02
    • 1970-01-01
    • 2016-11-04
    相关资源
    最近更新 更多