1

I am trying spinning wheel concept in iOS. My base tutorial is here

UIControl is core here. Superview's userinteraction was disabled always.

So how to enable userinteraction for its subviews alone?

enter image description here

I have added UITapGestureRecognizer to SmallRoundViews. Gesture is not working.

If I change superview's userinteraction to enable, gesture is working. But, its not spinning.

If I change superview's userinteraction to disable, spinning is working. But gesture is not working.

I need everything to be done. Can you guide me?

McDonal_11
  • 3,935
  • 6
  • 24
  • 55
  • I don't know for sure but I can think of at least one reason for this to be impossible: Since interactions are propagated from the parent to its children it is likely that the parent does not delegate anything if interaction is disabled, period. Pseudo: `if userInteractionDisabled return else delegateToChildren()` – luk2302 Dec 29 '17 at 12:45
  • 1
    https://stackoverflow.com/a/38217199/1979882 – Vyacheslav Dec 29 '17 at 12:46
  • No. Everything is not working. Kindly do needful – McDonal_11 Dec 29 '17 at 13:47

1 Answers1

2

Following code is working for,

If I change superview's userinteraction to true, both UITapGestureRecognizer and spinning is working..

Override UITouch method in UIControl subclass.

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

        let touch : UITouch = touches.first!
        self.beginTracking(touch, with: event)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {

        let touch : UITouch = touches.first!
        self.continueTracking(touch, with: event)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {

        let touch : UITouch = touches.first!
        self.endTracking(touch, with: event)

}
McDonal_11
  • 3,935
  • 6
  • 24
  • 55