Skip to content

Commit

Permalink
Added instructions to README
Browse files Browse the repository at this point in the history
  • Loading branch information
TimOliver committed Sep 21, 2015
1 parent f93d0a3 commit 7747ac1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![License](https://img.shields.io/cocoapods/l/TOCropViewController.svg?style=flat)](http://cocoadocs.org/docsets/TOCropViewController)
[![Platform](https://img.shields.io/cocoapods/p/TOCropViewController.svg?style=flat)](http://cocoadocs.org/docsets/TOCropViewController)

TOCropViewController is an open-source `UIViewController` subclass built to allow users to perform basic manipulation on UIImage objects; specifically cropping and some basic rotations. It has been designed with the iOS 8 Photos app in mind, and as such, behaves in an already familiar way.
TOCropViewController is an open-source `UIViewController` subclass built to allow users to perform basic manipulation on `UIImage` objects; specifically cropping and some basic rotations. It has been designed with the iOS 8 Photos app in mind, and as such, behaves in an already familiar way.

## Features
* Crop images by dragging the edges of a grid overlay.
Expand All @@ -33,6 +33,21 @@ pod 'TOCropViewController'
#### Manual
Add the files in the TOCropViewController subfolder to your Xcode project.

## How do I use it?
`TOCropViewController` operates around a very textbook modal setup. As such, it cannot be pushed to a `UINavigationController` stack, and instead must be presented as a modal dialog on an existing view controller.

```
UIImage *image = ...; //Load an image
TOCropViewController *cropViewController = [[TOCropViewController alloc] initWithImage:image];
cropViewController.delegate = self;
[self presentViewController:cropViewController animated:YES completion:nil];
```

Optionally, `TOCropViewController` also supports a custom presentation animation, providing more visual context to the user. Please see the sample app for a demonstration on how to implement this.


## How does it work?
While traditional cropping UI implementations will usually just have a dimming view with a square hole cut out of the middle, `TOCropViewController` goes about its implementation a little differently.

Expand All @@ -41,4 +56,4 @@ While traditional cropping UI implementations will usually just have a dimming v
Since there are two views that are overlaid over the image (A dimming view and a translucency view), trying to cut a hole open in both of them would be rather complex. Instead, an image view is placed in a scroll view in the background, and a copy of the image view is placed on top, inside a container view that is clipped to the designated cropping size. The size and position of the foreground image is then made to match the background view, creating the illusion that there is a hole in the dimming views, and minimising the number of views onscreen.

## License
TOCropViewController is licensed under the MIT License, please see the LICENSE file.
TOCropViewController is licensed under the MIT License, please see the LICENSE file.

0 comments on commit 7747ac1

Please sign in to comment.