Repo for Photo Picker Plus by Chute
Objective-C Other

README.md

Important

There has been a complete rework of the PhotoPicker component.

If you are using the old legacy code you can find it in the pp-v1-legacy branch. Read the documentation and migrate to the new version of the Photo Picker. It contains the Library and a Sample Project which you can use as a reference.

Native Android Component

The Android component has been moved into its own separate GitHub Repository.

You can find it on the following link along with the sample project: https://github.com/chute/photo-picker-plus-android

PhotoPickerPlus

No external dependancies beyond Chute SDK which you can also find here:

https://github.com/chute/Chute-SDK-v2-iOS

Description

This class allows you to pick a photo or a video from any supported online source such as Facebook, Instagram and Dropbox among others. It also replaces the standard picker in that it allows you to pick photos and videos from the device, take photo or record video with the camera or just to pick the latest photo/video in your library. It has integrated support for multiple image selection, just as the original Image Picker from Apple.

Screenshots

screen1 screen2 screen3 screen4 screen5 screen6 screen7 screen8 screen9 screen10 screen11 screen12 screen13

Configuration

First you need to setup the configuration. Follow Photo Picker Configuration on how to initialize PhotoPicker+ component with proper configuration.

Initialization

  • isMultipleSelectionEnabled - BOOL - If YES, picker does multi image selection, if NO, picker does single image selection.
  • delegate NSObject <PhotoPickerPlusDelegate> - The delegate for this component. It should implement two of the following delegate methods, depending on single or multiple selection.
  • - (void)imagePickerController:(PhotoPickerViewController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;
  • - (void)imagePickerController:(PhotoPickerViewController *)picker didFinishPickingArrayOfMediaWithInfo:(NSArray *)info;
  • - (void)imagePickerControllerDidCancel:(PhotoPickerViewController *)picker;

Implementation

You will need to implement PhotoPickerViewController.h in your .h file. You will also need to put <PhotoPickerViewControllerDelegate>

	- (void)imagePickerControllerDidCancel:(PhotoPickerViewController *)picker{
    	if (self.popoverController) {
        	[self.popoverController dismissPopoverAnimated:YES];
    	}
    	else {
        	[self dismissViewControllerAnimated:YES completion:nil];
    	}
	}
	
    ///////////////////////////
    //	  Single Selection   //
    ///////////////////////////
    
    - (void)showPhotoPickerPlus {
    	PhotoPickerViewController *picker = [PhotoPickerViewController new];
    	[picker setDelegate:self];
    	[picker setIsMultipleSelectionEnabled:NO];
    
    	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        	if (![[self popoverController] isPopoverVisible]) {
            	UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
            	[popover presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
	            self.popoverController = popover;
    	    }
        	else {
            	[[self popoverController] dismissPopoverAnimated:YES];
	        }
    	}
	    else {
    	    [self presentViewController:picker animated:YES completion:nil];
	    }
	}
	
	- (void)imagePickerController:(PhotoPickerViewController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
		//place code for when the user picks photos here and do any
	    //additional work such as removing the picker from the screen
	}
	
	///////////////////////////
    //	  Multi Selection    //
    ///////////////////////////
    
    - (void)showPhotoPickerPlus {
    	PhotoPickerViewController *picker = [PhotoPickerViewController new];
    	[picker setDelegate:self];
    	[picker setIsMultipleSelectionEnabled:YES];
    	
    	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        	if (![[self popoverController] isPopoverVisible]) {
            	UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
            	[popover presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
            	self.popoverController = popover;
        	}
        	else {
            	[[self popoverController] dismissPopoverAnimated:YES];
        	}
    	}
    	else {
        	[self presentViewController:picker animated:YES completion:nil];
    	}
	}
	
	- (void)imagePickerController:(PhotoPickerViewController *)picker didFinishPickingArrayOfMediaWithInfo:(NSArray *)info{
		//place code for when the user picks photos here and do any
	    //additional work such as removing the picker from the screen
	}

Cocoapods

You can add this component using Cocoapods. Add pod PhotoPickerPlus to your podfile.

Tutorials

Adding PhotoPicker+ to an Existing Project

Creating a PhotoPicker+ Sample Project