i used this code to detect touch on an uiscrollview who is on top of uiview
subclass
.h file
@interface AppScrollView : UIScrollView
{
}
@end
.m file
#import "AppScrollView.h"
@implementation AppScrollView
- (id)initWithFrame:(CGRect)frame
{
return [super initWithFrame:frame];
}
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
// If not dragging, send event to next responder
if (!self.dragging)
[self.nextResponder touchesEnded: touches withEvent:event];
else
[super touchesEnded: touches withEvent: event];
}
@end
and then on another class i added
#import <UIKit/UIKit.h>
@class AppScrollView;
@interface SomeClass : UIViewController <UIScrollViewDelegate>
{
AppScrollView *scrollView;
...
}
@end
#import "AppScrollView.h"
@implementation SomeClass
...
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
// Process the single tap here
...
}
...
@end
i used also scroll1.delegate=self; but nothing happens!!!
Can anyone help me?
Use
Gesture Recognizers. SpecificallyUITapGestureRecognizer.