1

I have some UIButtons within a UIScrollView. I want to highlight when touched, but still scroll if dragged.

I do not want to delay the button touches. However, as soon as the scroll view detects a drag/scroll, I want to cancel the UIButton touch and proceed with the scrolling of the UIScrollView.

I have included the following...

_scrollView.delaysContentTouches = NO;

...but (obviously) the button touch does not cancel when dragged. Does anyone have any suggestions as to how I can implement this functionality?

This is very similar to the question asked here at:

iOS UIScrollView cancel UIButton touch on scroll

But I don't understand the answer as I'm a fairly new developer. more help on the answer would be much appreciated.

Community
  • 1
  • 1
Manesh
  • 528
  • 6
  • 20

1 Answers1

0

His answer means:

You should create a subclass of UIScrollView, and override touchesShouldCancelInContentView.

For each Button :"show highlight effect for UIControlEventTouchDown." mean:

[button addTarget:self action:@selector(onTouchDownBtn:) forControlEvents:UIControlEventTouchDown];

Not sure the answer works as you want, I just explain the answer.

tuledev
  • 10,177
  • 4
  • 29
  • 49