GithubHelp home page GithubHelp logo

yaoya / photo-picker-plus-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brightsoftdev/photo-picker-plus

0.0 1.0 0.0 25.92 MB

Repo for Photo Picker Plus by Chute

License: MIT License

Ruby 0.09% Objective-C 99.01% C 0.44% Shell 0.46%

photo-picker-plus-ios's Introduction

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

photo-picker-plus-ios's People

Contributors

olgalazarova avatar kexoth avatar darko1002001 avatar costonb avatar oliverdimitrov avatar alexmedearis avatar ctide avatar dmitric avatar gauravs avatar

Watchers

yaoyao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.