Swipe gesture interrupts UISlider control in iOS 13, but not previous iOS versions

前端 未结 4 1036
感情败类
感情败类 2021-01-19 05:37

Note: This is the iOS 13 beta, but also could apply to the official release tomorrow.

Update 2: I replaced it with a larger thumb

4条回答
  •  攒了一身酷
    2021-01-19 06:24

    What I did was use a gestureRecognizer function to stop any gestures if a touch was detected on my UISliders. Make sure to add UIGestureRecognizerDelegate and set the UISwipeGestureRecognizer's delegate to self.

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
    
       if touch.view == self.view.viewWithTag(viewTags.MySlider.rawValue) {
            return false
       }
       else if touch.view == self.view.viewWithTag(viewTags.AnotherSlider.rawValue) {
            return false
       }
    
       return true
    }
    

提交回复
热议问题