Here we will continue where we
left in our previous article. We already see how to create Action Sheet and
display it on our view controller. Now we are doing some changes in our Action
Sheet because we will use it in our sample, we will add delete option on the
top of the action sheet, for that add code in showActionSheet method in view controller on our previous code, give a name ‘Delete’ to your destructiveButtonTitle, like this:

destructiveButtonTitle:@"Delete"

after adding delete button code and run it the delete button will display in red color background, because it is an destructive button that's default use as a delete button works, it will looks like this:

Now, to fetch device images into view controller follow the
steps:

1.Create a new view controller on MainStoryboard and create an
outlet of an UIImageView and named it as ‘imageView’
and drag a UIButton and set it as action and named it as ‘browseImage’.

After adding the code when we click on the ‘Images’ button of action sheet ImageViewController will open but It
has no title, so to set title of ImageViewController
select it and goto ‘Attribute Inspector’
set title like this:

4.Now, open the ImageViewController.m file and implement
UIImagePickerControllerDelegate, UINavigationControllerDelegate in the
interface of ImageViewController, like this:

5. Now add an image on your project and named it “image.jpg” and go to your viewDidLoad: method and add this code for your ImageViewController background-

self.imageView.image = [UIImage imageNamed:@"image.jpg"];

6.Now, the action method that we created currently “browseImage:” add some code here, these
code will be responsible for opening the picker view to pick images from the
device (images that are available on the device):

First method
will be responsible for identifying the image that the user will select from
the device image library. And in this method we will write code which will
display the selected image on the ImageViewController’s background image.

Second method
will be responsible for cancelling the picker view when we click on cancel
button.

That’s it.

Now, go to ‘Product’ in the top menu bar and click
on Run to build and run the project
in the simulator.

And after click on ‘Show Action Sheet’ button to bring up
the action sheet. Now click on the Images
button, a new view controller that has all the device images in a group “Saved
Photos” will be open, now when we click on ‘Saved Photos’ a new view controller
will be open that will show all the images of ‘saved photos’ group, now when we
click on any image like I am, the selected image will be open on the ‘ImageViewController’
background image.