示例#1
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// set the background color of the view to white
			this.View.BackgroundColor = UIColor.White;
			
			// create our scroll view
			scrollView = new TapZoomScrollView (
				new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height - this.NavigationController.NavigationBar.Frame.Height));
			this.View.AddSubview (scrollView);
			
			// create our image view
			imageView = new UIImageView (UIImage.FromFile ("Images/halloween.jpg"));
			scrollView.ContentSize = imageView.Image.Size;
			scrollView.MaximumZoomScale = 3f;
			scrollView.MinimumZoomScale = .1f;
			scrollView.AddSubview (imageView);
			
			// when the scroll view wants to zoom, it asks for the view to zoom, so 
			// in this case, we tell it that we want it to zoom the image view
			scrollView.ViewForZoomingInScrollView += delegate(UIScrollView sv) {
				return imageView;
			};
		}
示例#2
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// set the background color of the view to white
			View.BackgroundColor = UIColor.White;

			imageView = new UIImageView (UIImage.FromFile ("Images/halloween.jpg"));

			var frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height);
			scrollView = new TapZoomScrollView (frame) {
				ContentSize = imageView.Image.Size,
				MaximumZoomScale = 3f,
				MinimumZoomScale = .1f,
			};
			scrollView.AddSubview (imageView);
			View.AddSubview (scrollView);

			// when the scroll view wants to zoom, it asks for the view to zoom, so
			// in this case, we tell it that we want it to zoom the image view
			scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => {
				return imageView;
			};
		}