Eduardo Coelho Eduardo Coelho - 5 months ago 55
iOS Question

Photo/Image Viewer for Monotouch

I've googled a bit but could not find a simple Image Viewer class to use in my MonoTouch app.

I don't need to show image thumbnails neither a complete photo album (with multiple photos).

I just need an image viewer to show an UIImageView, allowing the common fullscreen/zoom operations.

Obviously such viewer could be implemented using a

UIViewController
subclass with
UIGestureRecognizer
,
UIScrollView
and
UINavigationBar
trickery, but I don't want to reinvent the wheel. Does anyone know about an open source component available ?

It would also be useful to host such component in the new Xamarin Component Store

Thanks

Answer

Here it is.

Features:

  • Show both big images (larger than the screen) and small ones;
  • One tap to close view, two taps to zoom in/out. Pinch to zoom is also available;
  • Scrolling through available content. It's impossible to scroll image outside visible area. Thanks to UIScrollView's ContentSize property.

Suggestions for future:

  • I reduced code by removing UINavigationBar usage.
  • Also it's nice to add UIView's basic animation (fade in/out) when user opens/closes full screen image view.

Some relative info:

Any bug reports and suggestions are welcome!

Comments