Guest User

Untitled

a guest
May 27th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. //Have to derive from UIScrollView because the UIResponder calls aren't going through
  3. //to the view reliably. We'll just forward the calls as appropriate.
  4. @interface StfUIScrollView : UIScrollView
  5. {
  6. UIResponder * delegateResponder;
  7. }
  8.  
  9. @property (nonatomic, retain) UIResponder * delegateResponder;
  10.  
  11. @end
  12.  
  13.  
  14.  
  15. @implementation StfUIScrollView
  16.  
  17. @synthesize delegateResponder;
  18.  
  19. - (id)initWithFrame:(CGRect)frame responder:(UIResponder *)_responder {
  20. if (self = [super initWithFrame:frame]) {
  21. // Initialization code
  22. self.delegateResponder = _responder;
  23. }
  24. return self;
  25. }
  26.  
  27. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
  28. [self.delegateResponder touchesBegan:touches withEvent:event];
  29. [super touchesBegan:touches withEvent:event];
  30. }
  31.  
  32.  
  33. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
  34. if(self.dragging)
  35. [self.delegateResponder touchesCancelled:touches withEvent:event];
  36. [super touchesMoved:touches withEvent:event];
  37. }
  38.  
  39. - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
  40. [super touchesEnded:touches withEvent:event];
  41. if(!self.dragging)
  42. [self.delegateResponder touchesEnded:touches withEvent:event];
  43. }
  44.  
  45. @end
Add Comment
Please, Sign In to add comment