Piyush Hirpara Piyush Hirpara - 3 months ago 12
Objective-C Question

UIScrollview delaysContentTouches issue

I have

UIScrollView
loaded with
UIButtons
and on
UIButton
action I have highlighted
UIImage
of each
UIButton
.

If I don't set
delaysContentTouches
as
NO
then highlighted
UIImage
of
UIButton
will not shown if I touch up
UIButton
very fast. After I set
delaysContentTouches
property as
NO
then only
UIButton
highlighted
UIImage
is shown.

Now after setting
delaysContentTouches
property as NO for
UIScrollView
. I can not scroll my
UIScrollView
by dragging on the
UIButtons
. Now how can I resolve this issue.

Please give me an advise.

Thanks in advance.

Answer

OK I have resolved by implementing below method :

- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
    NSLog(@"touchesShouldCancelInContentView");

    if ([view isKindOfClass:[UIButton class]])
        return NO;
    else
        return YES;
}