1

I have a UIScrollView that has a custom UIView subclass. On this UIView there are several UIButtons spreads on the view, the hierarchy of the UIViewController is:

UIViewConteroller's View > Custom UIView > UIScrollView > Custom UIView > UIButtons.

The problem is that when I try to scroll the scrollView, it doesn't scroll if I start the scrolling from one of the buttons. It does scroll if I start it from one of the gaps between each button.

How can I make the scrollView scroll even when I start the scroll from the button (and the button will be triggered just if I click it)?

I've tried to set canCancelContentTouches to true but it didn't work. I've tried to subclass UIScrollView and override touchesShouldCancel but it still doesn't work when I start a scroll from one of the buttons...

Thank you!

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
FS.O6
  • 1,394
  • 2
  • 20
  • 42
  • could you post your hierarchy of viewController – Vinod Kumar Apr 04 '17 at 12:24
  • @VinodKumar `UIViewConteroller's View` > `Custom UIView` > `UIScrollView` > `Custom UIView` > `UIButtons` – FS.O6 Apr 04 '17 at 12:26
  • 1
    you might want to check [this Q&As](http://stackoverflow.com/questions/3512563/scrollview-not-scrolling-when-dragging-on-buttons). – Ahmad F Apr 04 '17 at 12:27
  • Possible duplicate of [ScrollView not scrolling when dragging on buttons](http://stackoverflow.com/questions/3512563/scrollview-not-scrolling-when-dragging-on-buttons) – ron27 Apr 04 '17 at 12:34
  • @AhmadF I've already tried it. It still doesn't work when I start a scroll from one of the buttons... – FS.O6 Apr 04 '17 at 12:34
  • @ron27 It's not a duplicate, the solution they've suggested doesn't work – FS.O6 Apr 04 '17 at 12:35
  • @FS.O6 Okay. Thanks for the reply. – ron27 Apr 04 '17 at 12:39

0 Answers0