Coder Social home page Coder Social logo

intmain / uzysassetspickercontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uzysjung/uzysassetspickercontroller

1.0 1.0 1.0 6.71 MB

Alternative UIImagePickerController , You can take a picture with camera and pick multiple photos and videos

License: MIT License

Ruby 1.11% Objective-C 98.89%

uzysassetspickercontroller's Introduction

UzysAssetsPickerController

License MIT CocoaPods License MIT

Alternative UIImagePickerController , You can take a picture with camera and choose multiple photos and videos

Screenshot

ScreenshotScreenshot UzysAssetsPickerController features:

  • Easy customization using Inferface Builder. (XIB - 'UzysAssetsPickerController.xib')
  • With Assetpicker, taking pictures and or making videos are also possible.
  • UzysAssetPickerController automatically update photos that has been taken & saved with other apps
  • ARC Only (if your project doesn't use ARC , Project -> Build Phases Tab -> Compile Sources Section -> Double Click on the file name Then add -fno-objc-arc to the popup window.)

Installation

  1. Just add pod 'UzysAssetsPickerController' to your Podfile.
  2. Copy over the files libary folder to your project folder

Usage

###Import header.

#import "UzysAssetsPickerController.h"

Customize Appearance of UzysAssetsPickerController

if you want to customize the appearance of UzysAssetsPickerController, you can init UzysAppearanceConfig instance, and config its property, then call

    + (void)setUpAppearanceConfig:(UzysAppearanceConfig *)config

of UzysAssetsPickerController before you init UzysAssetsPickerController

sample code is like this:

    UzysAppearanceConfig *appearanceConfig = [[UzysAppearanceConfig alloc] init];
    appearanceConfig.finishSelectionButtonColor = [UIColor blueColor];
    appearanceConfig.assetsGroupSelectedImageName = @"checker";
    [UzysAssetsPickerController setUpAppearanceConfig:appearanceConfig];

for more configable properties, please refer to UzysAppearanceConfig.h

open UzysAssetsPickerController

    UzysAssetsPickerController *picker = [[UzysAssetsPickerController alloc] init];
    picker.delegate = self;
    picker.maximumNumberOfSelectionMedia = 2;
    [self presentViewController:picker animated:YES completion:^{

    }];

UzysAssetPickerControllerDelegate

- (void)uzysAssetsPickerController:(UzysAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets
{
    __weak typeof(self) weakSelf = self;
    if([[assets[0] valueForProperty:@"ALAssetPropertyType"] isEqualToString:@"ALAssetTypePhoto"]) //Photo
    {
            [assets enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
                ALAsset *representation = obj;

                    UIImage *img = [UIImage imageWithCGImage:representation.defaultRepresentation.fullResolutionImage
                                                       scale:representation.defaultRepresentation.scale
                                                 orientation:(UIImageOrientation)representation.defaultRepresentation.orientation];
                weakSelf.imageView.image = img;
                *stop = YES;
            }];


    }
    else //Video
    {
        ALAsset *alAsset = assets[0];

        UIImage *img = [UIImage imageWithCGImage:alAsset.defaultRepresentation.fullResolutionImage
                                           scale:alAsset.defaultRepresentation.scale
                                     orientation:(UIImageOrientation)alAsset.defaultRepresentation.orientation];
        weakSelf.imageView.image = img;



        ALAssetRepresentation *representation = alAsset.defaultRepresentation;
        NSURL *movieURL = representation.url;
        NSURL *uploadURL = [NSURL fileURLWithPath:[[NSTemporaryDirectory() stringByAppendingPathComponent:@"test"] stringByAppendingString:@".mp4"]];
        AVAsset *asset      = [AVURLAsset URLAssetWithURL:movieURL options:nil];
        AVAssetExportSession *session =
        [AVAssetExportSession exportSessionWithAsset:asset presetName:AVAssetExportPresetMediumQuality];

        session.outputFileType  = AVFileTypeQuickTimeMovie;
        session.outputURL       = uploadURL;

        [session exportAsynchronouslyWithCompletionHandler:^{

            if (session.status == AVAssetExportSessionStatusCompleted)
            {
                NSLog(@"output Video URL %@",uploadURL);
            }

        }];

    }
}

filter option

images only

  UzysAssetsPickerController *picker = [[UzysAssetsPickerController alloc] init];
  picker.delegate = self;
  picker.maximumNumberOfSelectionVideo = 0;
  picker.maximumNumberOfSelectionPhoto = 3;

videos only

  UzysAssetsPickerController *picker = [[UzysAssetsPickerController alloc] init];
  picker.delegate = self;
  picker.maximumNumberOfSelectionVideo = 3;
  picker.maximumNumberOfSelectionPhoto = 0;

images or videos

  UzysAssetsPickerController *picker = [[UzysAssetsPickerController alloc] init];
  picker.delegate = self;
  picker.maximumNumberOfSelectionVideo = 4;
  picker.maximumNumberOfSelectionPhoto = 3;

both images and videos

  UzysAssetsPickerController *picker = [[UzysAssetsPickerController alloc] init];
  picker.delegate = self;
  picker.maximumNumberOfSelectionMedia = 5;

Customization

  • You can easily modify UzysAssetsPickerController Design using InterfaceBuilder
  • check out 'UzysAssetsPickerController.xib'

ChangeLog

  • V0.9.6 - changing Delegate Method name because of supporting Swift. #28
  • V0.9.7 - fixed self retain bug
  • V0.9.8 - implement selection order; settings to change cellspacing columns number; support cocoapod on SWIFT

Contact

License

uzysassetspickercontroller's People

Contributors

astrokin avatar hunterbridges avatar intmain avatar mamaral avatar pomu0325 avatar ransomweaver avatar runexes avatar uzysjung avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lao-ben

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.