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.
Here's what works for me. Subclass UIScrollView, and implement only this method:
- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
return YES;
}
Then set delaysContentTouches = NO;
Voila! Works just like the home screen: Highlights buttons immediately, but still allows scrolling :)
I found that in iOS 8, the UIScrollView's underlying UIPanGestureRecognizer is not respecting the UIScrollView's delaysContentTouches property. I consider this an iOS 8 bug. Here's my workaround:
theScrollView.panGestureRecognizer.delaysTouchesBegan = theScrollView.delaysContentTouches
OK I have resolved by implementing below method :
- (BOOL)touchesShouldCancelInContentView:(UIView *)view
{
NSLog(@"touchesShouldCancelInContentView");
if ([view isKindOfClass:[UIButton class]])
return NO;
else
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With