Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Have to derive from UIScrollView because the UIResponder calls aren't going through
- //to the view reliably. We'll just forward the calls as appropriate.
- @interface StfUIScrollView : UIScrollView
- {
- UIResponder * delegateResponder;
- }
- @property (nonatomic, retain) UIResponder * delegateResponder;
- @end
- @implementation StfUIScrollView
- @synthesize delegateResponder;
- - (id)initWithFrame:(CGRect)frame responder:(UIResponder *)_responder {
- if (self = [super initWithFrame:frame]) {
- // Initialization code
- self.delegateResponder = _responder;
- }
- return self;
- }
- - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- [self.delegateResponder touchesBegan:touches withEvent:event];
- [super touchesBegan:touches withEvent:event];
- }
- - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- if(self.dragging)
- [self.delegateResponder touchesCancelled:touches withEvent:event];
- [super touchesMoved:touches withEvent:event];
- }
- - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- [super touchesEnded:touches withEvent:event];
- if(!self.dragging)
- [self.delegateResponder touchesEnded:touches withEvent:event];
- }
- @end
Add Comment
Please, Sign In to add comment