get hold of UIResponder instance methods on UIScrollView. iPhone
-
27-03-2021 - |
質問
on the current project I am working on, on one of the views, I have a UIView
and on top of it UIScrollView
which is constructed from the interface builder.
I have implemented the following UIResponder
instance methods:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
but the control comes to this methods only when touch event occur in area where is not covered by the UIScrollView
.
how I can get the hold of a touch event on the UIScrollView
also?
解決
you could create a subclass of UIScrollView and override:
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
you have to be careful that you don't interfere with the scrolling gestures etc tho.
所属していません StackOverflow