Repolode
TimOliver

TimOliver/TOCropViewController

An iOS view controller for cropping UIImage objects, with rotation, circular crop, and aspect-ratio locking, modeled on the Photos app editor.

Stars
4,948
Forks
1,027
Open issues
106
Last commit
15 hours ago

What is it?

TOCropViewController is an open-source UIViewController subclass for iOS that lets users crop sections out of UIImage objects and perform basic 90-degree rotations. It is aimed at cases like editing profile pictures or sharing part of a photo, and its behavior is designed to match the iOS Photos app editor so users find it familiar.

The controller can return the cropped image to a delegate, or pass it straight to a UIActivityViewController. It also offers circular cropping, aspect ratio clamping, a reset button, and custom opening and dismissal animations. A Swift wrapper named CropViewController provides a more Swift-native interface on top of the Objective-C class.

The library can be installed through CocoaPods, Swift Package Manager, Carthage, or by copying the source files manually. It requires iOS 12.0 or later and is localized in 28 languages.

Key features

  • 01Crop by dragging the edges of a grid overlay.
  • 02Crop circular images as well as rectangular ones.
  • 03Rotate images in 90-degree steps.
  • 04Lock the crop box to a fixed aspect ratio.
  • 05Return the result via delegate or open a share sheet directly.
  • 06Provides a Swift wrapper alongside the Objective-C class.

Use cases

  • Letting users crop profile avatars to a circle in an iOS app.
  • Adding a photo crop step before uploading or sharing an image.
  • Building an in-app image editor that follows the iOS Photos editing flow.

Quick start

  1. 1

    Add the pod to your Podfile (Objective-C)

    pod 'TOCropViewController'
  2. 2

    Or add the Swift pod to your Podfile (Swift)

    pod 'CropViewController'
  3. 3

    Create a TOCropViewController with your UIImage, set a delegate, and present it modally in your app code

Things to know

  • Targets iOS only, requiring iOS 12.0 or above.
  • visionOS and Mac Catalyst modes are enabled but not officially supported.

In collections

Topics

FAQ

What is TOCropViewController?
An iOS view controller for cropping UIImage objects, with rotation, circular crop, and aspect-ratio locking, modeled on the Photos app editor. TOCropViewController is an open-source UIViewController subclass for iOS that lets users crop sections out of UIImage objects and perform basic 90-degree rotations. It is aimed at cases like editing profile pictures or sharing part of a photo, and its behavior is designed to match the iOS Photos app editor so users find it familiar.
Is TOCropViewController free to use? What license does it have?
TOCropViewController is open source under the MIT license. Check the license terms before using it in commercial products.
Is TOCropViewController still maintained?
Actively maintained. The last commit to TOCropViewController was on Nov 7, 2026.
What can I use TOCropViewController for?
Letting users crop profile avatars to a circle in an iOS app. Adding a photo crop step before uploading or sharing an image. Building an in-app image editor that follows the iOS Photos editing flow.
How do I install TOCropViewController?
Add the pod to your Podfile (Objective-C): pod 'TOCropViewController' Or add the Swift pod to your Podfile (Swift): pod 'CropViewController' Create a TOCropViewController with your UIImage, set a delegate, and present it modally in your app code
Where can I get TOCropViewController?
The source code and installation instructions are on GitHub: https://github.com/TimOliver/TOCropViewController

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects