I have a UIControl inside a UIScrollView. In my UIControl's init
, I rig up some touch event handlers, e.g.
[self addTarget:_delegate
action:@selector(touchedDown) forControlEvents:UIControlEventTouchDown];
iOS6 and iOS7 behave differently when I do the following:
In iOS6, my app continues to behave as intended: the tap at step #2 does not call touchedDown
-- the UIScrollView swallows the touch event as it immediately stops scrolling.
But in iOS7, the UIScrollView stops scrolling as expected, while touchedDown
is still called.
Was there a documented API change? I'd like my app to behave identically to iOS6 in iOS7.
workaround for iOS 7
@interface UIScrollViewFixed : UIScrollView
@end
@implementation UIScrollViewFixed
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if (self.isDragging || self.isDecelerating) {
return self;
}
return [super hitTest:point withEvent:event];
}
@end