Skip to content

Instantly share code, notes, and snippets.

@muhku
Created July 3, 2012 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muhku/3039602 to your computer and use it in GitHub Desktop.
Save muhku/3039602 to your computer and use it in GitHub Desktop.
diff --git a/Classes/Views/MAWeekView.m b/Classes/Views/MAWeekView.m
index 0a538cb..8bbd04e 100644
--- a/Classes/Views/MAWeekView.m
+++ b/Classes/Views/MAWeekView.m
@@ -63,6 +63,7 @@ static const unsigned int TOP_BACKGROUND_HEIGHT = 35;
CGRect _textRect;
size_t _xOffset;
size_t _yOffset;
+ CGPoint _touchStart;
}
- (void)setupCustomInitialisation;
@@ -316,6 +317,7 @@ static const unsigned int TOP_BACKGROUND_HEIGHT = 35;
_scrollView.backgroundColor = [UIColor whiteColor];
_scrollView.scrollEnabled = TRUE;
_scrollView.alwaysBounceVertical = TRUE;
+ _scrollView.canCancelContentTouches = NO;
}
return _scrollView;
}
@@ -823,6 +825,7 @@ static const CGFloat kCorner = 5.0;
twoFingerTapIsPossible = NO;
multipleTouches = NO;
delegate = self;
+ self.exclusiveTouch = YES;
self.alpha = kAlpha;
CALayer *layer = [self layer];
@@ -852,4 +855,17 @@ static const CGFloat kCorner = 5.0;
}
}
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ _touchStart = [[touches anyObject] locationInView:self];
+ [super touchesBegan:touches withEvent:event];
+}
+
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
+{
+ [super touchesMoved:touches withEvent:event];
+ CGPoint point = [[touches anyObject] locationInView:self];
+ self.center = CGPointMake(self.center.x + point.x - _touchStart.x, self.center.y + point.y - _touchStart.y);
+}
+
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment