SSPhotoCropperViewController: A custom ViewController that provides UI for cropping photos in iOS apps
We all sometimes do something with photos in our apps. And apps that deal with photos in some way, whether it be editing, stylishing or sharing them, are becoming more and more popular every day.
In one of my apps I was recently working on, I needed a simple UI to crop a picture into a square shape. So I wrote SSPhotoCropperViewController. It’s a custom view controller that provides a simple, configurable and easy-to-use UI for cropping and scaling photos in iPhone & iPod Touch apps.
Add SSPhotoCropperViewController to Your Project
- Grab the source code from GitHub: https://github.com/ardalahmet/SSPhotoCropperViewController
- Copy “SSPhotoCropperDemo/SSPhotoCropper” folder contents into your project folder and add them to your project from Xcode.
In the view controller that you will show SSPhotoCropperViewController, implement SSPhotoCropperDelegate methods to interact with SSPhotoCropperViewController.
Create and Show SSPhotoCropperViewController
- Create an SSPhotoCropperViewController object instance by using one of the -init methods provided, set the source photo, UI mode etc.
- Configure it by modifying some properties before showing the view controller.
- Show it by presenting it as a modal view controller or by pushing it on to a navigation controller.
- The demo project on GitHub includes a simple example on how to use SSPhotoCropperViewController. Have a look at it if you encounter a problem using SSPhotoCropperViewController in your project.
- Questions, suggestions, bug-reports, github forks & any other contributions are welcome. Don’t hesitate to contact me at @ardalahmet or via ardalahmet(at)gmail.com.
- The source code is licensed under the Apache License, Version 2.0. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- You can modify the source code to make it meet your needs. You may want to change the crop square size or crop photos into rectangle shapes etc.