Reputation: 1885
I am developping an iPad app using Xamaring that has several views in the storyboard (UIView
and UITableView
). My users want to zoom on usual pages (as they are used to in a web browser or so).
So, having read about UIScrollView
, I simply tried to put my page views embedded within a UIScrollView
, but I can neither scroll nor pinch-zoom: nothing happens.
As for the setup: in the StoryBoard, I add a UIScrollView
to the UIViewController
which fills the parent. I then add content to the UIScrollView
, which I want to be zoomable (e.g. for people with poor sight).
So the question is quite simple: how can I get a view fitting within its original parent but that can be zoomed onto ?
Thanks in advance!
Upvotes: 0
Views: 1043
Reputation: 719
I have never done this myself, so I dont know if this is all it takes. But have you added the max- and min-scroll and all that?
scrollView.MaximumZoomScale = 3f;
scrollView.MinimumZoomScale = .1f;
scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
(in your case i guess it needs to return the view);
If that doesent do the trick, take a look at "Scrolling and zooming a view hierarchy on this page: http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content
Upvotes: 1