Latest 2.0.2
Homepage https://github.com/carezone/CZPhotoPickerController
License Apache 2.0
Platforms ios 11.0, requires ARC
Frameworks AssetsLibrary, MobileCoreServices
Authors , ,

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] initWithCompletionBlock:^(UIImagePickerController *imagePickerController, NSDictionary *imageInfoDict) {

  UIImage *image = imageInfoDict[UIImagePickerControllerEditedImage];
  if (!image) {
    image = imageInfoDict[UIImagePickerControllerOriginalImage];
  }

  weakSelf.imageView.image = image;

  if (weakSelf.presentedViewController) {
    [weakSelf dismissViewControllerAnimated:YES completion:nil];
  }
}];

self.photoPicker.allowsEditing = YES; // optional

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

[self.photoPicker presentFromViewController:self];

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.

Latest podspec

{
    "name": "CZPhotoPickerController",
    "version": "2.0.2",
    "summary": "A photo picker offering 'use last photo taken', 'take photo', and 'choose from library'.",
    "homepage": "https://github.com/carezone/CZPhotoPickerController",
    "license": "Apache 2.0",
    "authors": {
        "Brian Cooke": "[email protected]",
        "Peyman Oreizy": "[email protected]",
        "Victor Ilyukevich": ""
    },
    "source": {
        "git": "https://github.com/carezone/CZPhotoPickerController.git",
        "tag": "2.0.2"
    },
    "platforms": {
        "ios": "11.0"
    },
    "frameworks": [
        "AssetsLibrary",
        "MobileCoreServices"
    ],
    "source_files": "CZPhotoPickerController",
    "resource_bundles": {
        "CZPhotoPickerController": [
            "CZPhotoPickerController/CZPhotoPreviewViewController.xib"
        ]
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This