Search code examples
iosios13uicontrol

UIControl tracking and iOS 13 presentation style cards not working together


I am using AORangeSlider which is a subclass of UIControl that overrides the beginTracking, continueTracking and endTracking methods.

When this control is added to a viewController, which is presented in iOS 13 using the "cards style", it has very strange behavior. When sliding the control the viewController will try to swipe down, and it interrupts the slider behavior and makes it unreliable and not work correctly.

enter image description here

If I instead, I present the viewController with UIModalPresentationFullScreen the control works correctly.

Is there a way to allow the AORangeSlider/UIControl to work with the iOS 13 cards style of presentation and not have their touch events conflict?


Solution

  • Had to ask Apple about this, and they recommended the following solution, which worked:

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