TimOliver /TOCropViewController
A view controller for iOS that allows users to crop portions of UIImage objects
★ 4,948⑂ 1,028👁 80⑃ 244● 416▤ 24
+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
#395Mac OS Catalyst Support12 comments · 2019-11-29#429'TOCropViewConstants.h' file not found11 comments · 2020-09-04#655Unable to see Cancel and Done buttons by default in version 3.2.0 ,doneIconButton,cancelIconButton And doneTextButton ,cancelTextButton can not see,I hope the author can fix it as soon as possibleI hope the author can fix it as soon as possible10 comments · 2026-08-05#477Crop View Controller just dismisses on iPad on any toolbar button press10 comments · 2021-02-08#4232.5.3 SPM Won't compile10 comments · 2020-07-17#46Set Cropper Minimum Size9 comments · 2016-01-21#68Question - can i fix the height and width of the required image to 130 x 600?8 comments · 2016-02-26#421SwiftUI example of using TOCropViewController7 comments · 2020-07-14
Discussions
#559Hello Tim, thanks for the development!0 comments · 2023-09-08#499Adding Aspect ratios4 comments · 2021-10-20#469Can you disable cropping, using only the rotate functionality?0 comments · 2021-01-11#452Welcome to TOCropViewController Discussions!4 comments · 2020-12-09
Latest release
v3.3.0 3.3.0 2026-11-08Added - 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