質問

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top