Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enable Zooming

  • Loading branch information...
commit f3f6f985579b7cfb2eaf7353b076d2788de851f4 1 parent 308a286
@paulcbetts authored
Showing with 21 additions and 4 deletions.
  1. +21 −4 Hypnosister/Hypnosister/AppDelegate.cs
View
25 Hypnosister/Hypnosister/AppDelegate.cs
@@ -32,12 +32,15 @@ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
window.AddSubview(scrollView);
var view = new HypnosisView() { Frame = window.Bounds };
- var anotherView = new HypnosisView() { Frame = new RectangleF(window.Bounds.Width, 0.0f, window.Bounds.Width, window.Bounds.Height) };
scrollView.AddSubview(view);
- scrollView.AddSubview(anotherView);
- scrollView.ContentSize = new SizeF(window.Bounds.Width * 2.0f, window.Bounds.Height);
- scrollView.PagingEnabled = true;
+ scrollView.ContentSize = window.Bounds.Size;
+
+ scrollView.MinimumZoomScale = 1.0f;
+ scrollView.MaximumZoomScale = 5.0f;
+ scrollView.Delegate = new HSAnonScrollViewerDelegate(sv => {
+ return view;
+ });
window.BackgroundColor = UIColor.White;
@@ -47,5 +50,19 @@ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
return true;
}
}
+
+ public class HSAnonScrollViewerDelegate : UIScrollViewDelegate
+ {
+ Func<UIScrollView, UIView> viewForZoomingInScrollView;
+ public HSAnonScrollViewerDelegate(Func<UIScrollView, UIView> viewForZoomingInScrollView)
+ {
+ this.viewForZoomingInScrollView = viewForZoomingInScrollView;
+ }
+
+ public override UIView ViewForZoomingInScrollView (UIScrollView scrollView)
+ {
+ return viewForZoomingInScrollView(scrollView);
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.