In my iPad program I have an array which holds images. How can I display my all images (from an image array) in my viewController the same as the below screen shot? Is there a good way to do it, any sample application paths to refer or sample code?
I need the following functionality.
- Tapping an image will show it full screen
- A close button to close this view as the same as the screen shot.
- Two buttons to display the remaining and previous images.
A sample screen shot is attached below. We can see that the below application is showing all images at the right side of the screen.

Alright, this should be easy, though a bit of coding is needed.
Start out with a simple view based app template.
I don’t know where the images come from so I just put all the images to be shown in the resources folder.
The view controller
PictureViewControllerwill accept an array of UIImages and should be presented modally. I’ll post the code below.The code to show the
PictureViewControlleris placed in the view controller created by the template. I just added a simple UIButton to the view to trigger an action which looks something like this:The view controller’s view was created with interface builder, looking like this:
PictureViewController.xib
View Hierarchy
The fullscreen image is linked to an outlet
fullScreenImageseen in the following header file. Actions are connected as well.I’ve set the fullscreen imageView’s content mode to Aspect Fit.
The Thumbnails will be added dynamically with code. Here’s the view controller’s code
PictureViewController.h
PictureViewController.m
The define
MAX_THUMBNAILSon top defines the maximum of thumbnails seen. AUITapGestureRecognizerwill take care of the tap events for the thumbnails. Adjust theCGRectMakeinsetupThumbnailImageViewsto position the thumbnails as you wish. This controller is just a basic approach without orientation support.The result: