user1181226
user1181226

Reputation: 47

ViewForZoomingInScrollView in MonoTouch

I am trying to implement a ViewForZoomingInScrollView using MonoTouch. The user takes a picture and the image is added using the code below

scrollView.AddSubview (imageView);
scrollView.MinimumZoomScale = 1.0f;
scrollView.MaximumZoomScale = 3.0f;
scrollView.MultipleTouchEnabled = true;
scrollView.ViewForZoomingInScrollView = delegate(UIScrollView scrollView2) 
{
        return imageView;           
};

If I swipe a finger across the window I can go from image to image without a problem.
When I try to pinch an image the image moves to the right and I have white space.

Question:

When you pinch the images what steps do you need take in code to re-size and display the enlarged image in the center of the image view?

Upvotes: 1

Views: 1380

Answers (1)

poupou
poupou

Reputation: 43553

There are many Xamarin's samples that show how to use ViewForZoomingInScrollView. You can get them all from github or you can browser them from the sample web site.

This includes the ZoomingPdfViewer (a port of Apple's Objective-C sample of the same name). See Souce Code.

Upvotes: 1

Related Questions