Skip to main content
Language

Present Photo Editor using UIKit

The PhotoEditViewController class is responsible for presenting and rendering a photo. It can be presented modally as in this example in which case it will display a toolbar at the bottom or it can be pushed onto a UINavigationController in which case it will use the navigation controller’s navigation bar. It also handles the presentation of PhotoEditToolController subclasses.

Create the photo edit controller#

In this example, we present a photo from the bundle passing the URL to the Photo constructor. We then initialize a PhotoEditViewController instance passing the photo as photoAsset.

Implement delegate method#

We set the delegate of the PhotoEditViewController object to self. That means that the presenting view controller must implement the PhotoEditViewControllerDelegate protocol. The methods of the PhotoEditViewControllerDelegate protocol are designed to inform the delegate about the result of the editing process (for example cancellation).

When a user confirms the edits to a photo the photoEditViewControllerDidFinish method is called and the data to the finished photo is passed as part of the result type argument.

Next Steps#