An iOS UI component lets users crop UIImage regions and perform basic rotations. It targets profile-photo editing and sharing cropped image areas, with interaction modeled after the iOS Photos editor.
Overview
TOCropViewController is an open-source UIViewController subclass for cropping sections of UIImage instances and applying simple rotations. It suits profile picture edits and sharing selected parts of a photo online.
Users crop by dragging edges on a grid overlay, optionally produce circular crops, rotate in 90-degree steps, constrain aspect ratio, and reset all edits. Output can return to a delegate or go straight to a UIActivityViewController for sharing.
The control supports custom present and dismiss animations, layout adjustments when rotating to landscape, and localization in many languages. Swift developers can use a separate CropViewController wrapper that encapsulates the Objective-C API with a Swift-oriented interface. It is installable via CocoaPods, Swift Package Manager, Carthage, or manual source copy into an Xcode project.
Key features
- Grid-based image cropping
- Optional circular crop output
- 90-degree rotation steps
- Fixed aspect ratio clamping
- Reset to undo edits
- Delegate or share-sheet result delivery
- Custom presentation animations
- Localized UI strings
Use cases
- Profile photo cropping in iOS apps
- In-app image editing before upload
- Sharing a cropped region via system share sheet
- Circular avatar generation