I am trying to get the UIScrollView to work in my Monotouch application. No matter what I set the SetZoomScale() to it always ignores my starting ratio. Ideally I want it to 0.5f zoom when I start up.
theGraphScrollView = new UIScrollView(theRect); // Half of the screen height, full width of screen
this.View.AddSubview(theGraphScrollView);
UIImageView imageView = new UIImageView(thePhotoSource.LoadPhotoFromFile("IMG_0_17.JPG"));
theGraphScrollView.ContentSize = imageView.Image.Size; // This is much bigger than the screen width and height.
theGraphScrollView.MaximumZoomScale = 3f;
theGraphScrollView.MinimumZoomScale = 0.5f;
theGraphScrollView.SetZoomScale(0.5f, true);
theGraphScrollView.AddSubview(imageView);
theGraphScrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
Can anyone tell me where I am going wrong.
Many thanks.
You need
SetZoomScale()at the end.ViewForZoomingInScrollViewshould be hooked up prior to changing the zoom.