Search code examples
iosobjective-ccocoa-touchuiscrollview

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.


Solution

  • OK I have resolved by implementing below method :

    - (BOOL)touchesShouldCancelInContentView:(UIView *)view
    {
        NSLog(@"touchesShouldCancelInContentView");
    
        if ([view isKindOfClass:[UIButton class]])
            return NO;
        else
            return YES;
    }