0

Using UIKit:

I've got a view that has multiple UIButton, but I can only scroll the view up or down if I began my scroll touch event outside the UIButton.

So how can I make it so that I can scroll my view, regardless if I start my touch event on a UIButton?

Mishka
  • 502
  • 5
  • 15
Giel Berkers
  • 2,852
  • 3
  • 39
  • 58

1 Answers1

0

If your view behaves like a scroll view, try solution as below It has been proposed here: https://stackoverflow.com/a/26292829/9191054 and it works!

 class UIButtonScrollView: UIScrollView {
    
        override func touchesShouldCancel(in view: UIView) -> Bool {
            if view.isKind(of: UIButton.self) {
              return true
            }
    
            return super.touchesShouldCancel(in: view)
        }    
    }
Mishka
  • 502
  • 5
  • 15