TimOliver /TOCropViewController

A view controller for iOS that allows users to crop portions of UIImage objects

★ 4,948⑂ 1,028👁 80⑃ 244● 416▤ 24
Objective-CMITCreated 2015-06-06
下载:v3.3.0v3.3.0 ↓3.3.02026-11-08
+0
日增长
4,948
stars
1,028
forks
80
watchers
244
prs
416
issues
24
releases

README

TOCropViewController






!Version


!Platform

TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basic rotations. It is excellent for things like editing profile pictures, or sharing parts of a photo online. It has been designed with the iOS Photos app editor in mind, and as such, behaves in a way that should already feel familiar to users of iOS.

For Swift developers, CropViewController is a Swift wrapper that completely encapsulates TOCropViewController and provides a much more native, Swiftier interface.

 Proudly powering apps by





_Looking for something more? If TOCropViewController doesn't meet your exact requirements, please consider IMG.LY with video editing and photo filter capabilities instead! (Disclaimer: Affiliate Link)_

 Features
 Crop images by dragging the edges of a grid overlay.
 Optionally, crop circular copies of images.
 Rotate images in 90-degree segments.
 Clamp the crop box to a specific aspect ratio.
 A reset button to completely undo all changes.
 iOS 7/8 translucency to make it easier to view the cropped region.
 The choice of having the controller return the cropped image to a delegate, or immediately pass it to a UIActivityViewController.
 A custom animation and layout when the device is rotated to landscape mode.
 Custom 'opening' and 'dismissal' animations.
 Localized in 28 languages.

 System Requirements
iOS 12.0 or above.

_Disclaimer: visionOS and Mac Catalyst modes are also enabled, however they are not officially supported. PRs are always welcome!_ 

 Installation


  CocoaPods
  
  Objective-C

Add the following to your Podfile:
 ruby
pod 'TOCropViewController'


Swift

Add the following to your Podfile:
 ruby
pod 'CropViewController'




  Swift Package Manager

Add the following to your Package.swift:
 swift
dependencies: [
  // ...
  .package(url: "https://github.com/TimOliver/TOCropViewController.git"),
],




  Carthage

1. Add the following to your Cartfile:
 
github "TimOliver/TOCropViewController"


2. Run carthage update

3. From the Carthage/Build folder, import one of the two frameworks into your Xcode project. For Objective-C projects, import just TOCropViewController.framework  and for Swift, import CropViewController.framework instead. Each framework is separate; you do not need to import both.

4. Follow the remaining steps on Getting Started with Carthage to finish integrating the framework.




Manual Installation

All of the necessary source and resource files for TOCropViewController are in Objective-C/TOCropViewController, and all of the necessary Swift files are in Swift/CropViewController.

For Objective-C projects, copy just the TOCropViewController directory to your Xcode project. For Swift projects, copy both TOCropViewController and CropViewController to your project.


 Examples
Using TOCropViewController is very straightforward. Simply create a new instance passing the UIImage object you wish to crop,

Top issues

Discussions

Latest release

v3.3.0 3.3.0 2026-11-08
Added

- Full support for iPhone Duo, in all rotations and screen states. This is still early days, so any feedback on how or if it can be improved would be appreciated! (660)
- TOCropToolbar.reverseVerticalContentLayout, which anchors the Done button to the bottom of a vertical toolbar instead of the top.
- -[TOCropView performRelayoutForBoundsChange], which lays the crop out again after its content bounds have shifted, carrying any crop the user has made across.

 Fixed

- On iOS 26, apps built with Xcode 16 (the iOS 18 SDK) showed no Done or Cancel buttons, as the toolbar laid itsel

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON