Permalink
Browse files

Prevent scrolling when zoomScale is 1.0

  • Loading branch information...
1 parent 858331c commit f8a43fdc060f7de3e9e9c57c7cbfde3fa2a384eb @myell0w committed Aug 1, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 MTZoomWindow.m
View
@@ -60,6 +60,8 @@ - (id)initWithFrame:(CGRect)frame {
_scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
_scrollView.delegate = self;
_scrollView.hidden = YES;
+ _scrollView.contentSize = CGSizeMake(1.f,1.f);
+ _scrollView.scrollEnabled = NO;
[self addSubview:_scrollView];
_zoomContentView = [[UIView alloc] initWithFrame:self.scrollView.bounds];
@@ -226,6 +228,13 @@ - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
}
- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
+ // if we zoomed in we want to allow panning around
+ if (scrollView.zoomScale > 1.f) {
+ scrollView.scrollEnabled = YES;
+ } else {
+ scrollView.scrollEnabled = NO;
+ }
+
if (self.zoomGestures & MTZoomGesturePinch) {
if (!scrollView.zooming && scrollView.zoomBouncing && scrollView.zoomScale <= 1.f) {
[self.zoomedView zoomOut];

0 comments on commit f8a43fd

Please sign in to comment.