CZPhotoPickerController 2.0.0

CZPhotoPickerController 2.0.0

TestsTested
LangLanguage Obj-CObjective C
License Apache 2
ReleasedLast Release Nov 2015

Maintained by Victor Ilyukevich, Peyman Oreizy, Justin Driscoll.


Downloads

Total32,732
Week0
Month0

Installs

Apps338
Pod Tries2
Test Targets21
Watch Apps2
powered by Segment

GitHub

Stars76
Watchers29
Forks29
Issues2
Contributors8
Pull Requests0

Code

Files8
LOCLines of Code 543


  • By
  • Brian Cooke, Peyman Oreizy and Victor Ilyukevich

CZPhotoPickerController simplifies picking, taking, or using the last photo.

It presents a UIActionSheet with the appropriate options for the device, taking into account photo library permissions and whether or not the device has a camera, and then presents a UIImagePickerController (when picking an existing photo or taking a new one) or returns the last photo taken.

It supports the iPhone and iPad.

Installation

pod 'CZPhotoPickerController'

Usage:

__weak typeof(self) weakSelf = self;

self.photoPicker = [[CZPhotoPickerController alloc] initWithPresentingViewController:self withCompletionBlock:^(UIImagePickerController *imagePickerController, NSDictionary *imageInfoDict) {

  if (imagePickerController.allowsEditing) {
    weakSelf.imageView.image = imageInfoDict[UIImagePickerControllerEditedImage];
  }
  else {
    weakSelf.imageView.image = imageInfoDict[UIImagePickerControllerOriginalImage];
  }

  [weakSelf.photoPicker dismissAnimated:YES];
  weakSelf.photoPicker = nil;

}];

self.photoPicker.allowsEditing = YES; // optional

self.photoPicker.cropOverlaySize = CGSizeMake(320, 160); // optional

[self.photoPicker showFromBarButtonItem:btn];

If allowsEditing is YES, the user will be asked to resize the chosen image. Otherwise, a preview is shown.

If cropOverlaySize is set, the picker will crop the image to the aspect ratio of cropOverlaySize and the preview screen will highlight the cropped area. We'd love a pull request to support pinch and zoom too!

Screenshots

Action sheet

Allows editing

Contributing

Our uncrustify config is in ./config along with a shell script that will uncrustify the files in ./CZPhotoPickerController/. It requires uncrustify 0.60 which is available via homebrew with brew update && brew install uncrustify. Please run ./config/uncrustify.sh to clean up whitespace. Thank you!

Credits

CZPhotoPickerController was created by Brian Cooke and Peyman Oreizy in the development of CareZone Mobile for iOS.

Contact

Brian Cooke @bricooke

Peyman Oreizy @peymano

License

CZPhotoPickerController is available under the Apache 2.0 license. See the LICENSE file for more info.