Latest 0.0.4
Homepage https://github.com/leverdeterre/MediaPickerManager
License MIT
Platforms ios 5.0, requires ARC
Frameworks MobileCoreServices
Authors
  • allows to simplify usage of UIImagePickerController,
  • no need to manipulate UIPopoverController / UIActionSheet
  • more code clarity,
  • iPad and iPhone support.

Release note

v0.0.3 : Framework localization + bundle generation
v0.0.2 : Refactor

Shared object that

[MediaPickerManager sharedInstance]

Enum to configure the mediaPicker

typedef NS_OPTIONS(NSInteger,  JMMediaType) {
    JMMediaTypeCameraPhoto = 0,
    JMMediaTypeCameraVideo = 1 << 0,
    JMMediaTypeLibraryPhoto = 1 << 1,
    JMMediaTypeLibraryVideo = 1 << 2,
    JMMediaTypeCamera = JMMediaTypeCameraPhoto | JMMediaTypeCameraVideo,
    JMMediaTypeLibrary = JMMediaTypeLibraryPhoto | JMMediaTypeLibraryVideo,
    JMMediaTypePhotos = JMMediaTypeCameraPhoto | JMMediaTypeLibraryPhoto,
    JMMediaTypeVideos = JMMediaTypeCameraVideo | JMMediaTypeLibraryVideo,
    JMMediaTypeAll = JMMediaTypeCamera | JMMediaTypeLibrary,
};

Enum to configure the the presentation of ImagePicker

typedef NS_ENUM(NSInteger,  JMMediaPresentationStyle) {
    JMMediaPresentationStylePresentModal,
    JMMediaPresentationStyleAddSubView,
    JMMediaPresentationStyleCustom
};

Usage … very simple with a protocol

@protocol JMMediaPickerManagerDelegate <NSObject>
- (void)imagePickerControllerDidFinishPickingMediaWithInfo:(NSDictionary *)info;
@optional
- (void)customPresentImagePicker:(UIViewController *)controller;
- (void)customDismissImagePicker:(UIViewController *)controller;
@end
#import "MediaPickerManager.h"

- (IBAction)photoSelected:(id)sender 
{
    [MediaPickerManager sharedInstance].type = JMMediaTypePhotos;
    [MediaPickerManager sharedInstance].delegate = self;
    [[MediaPickerManager sharedInstance] presentPhotosFrom:sender];
}

#pragma mark JMMediaPickerManagerDelegate

- (void)imagePickerControllerDidFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSLog(@"%s",__FUNCTION__);

    NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    if ( [mediaType isEqualToString:@"public.movie" ])
    {
        NSLog(@"Picked a movie at URL %@",  [info objectForKey:UIImagePickerControllerMediaURL]);
        NSURL *url =  [info objectForKey:UIImagePickerControllerMediaURL];

    }
    else {
        UIImage *image=[info objectForKey:UIImagePickerControllerOriginalImage];
    }
}

Latest podspec

{
    "name": "MediaPickerManager",
    "version": "0.0.4",
    "requires_arc": true,
    "authors": {
        "Morissard Ju00e9rome": "[email protected]"
    },
    "platforms": {
        "ios": "5.0"
    },
    "summary": "Easy-to-use UIImagePicker.",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/leverdeterre/MediaPickerManager",
    "source": {
        "git": "https://github.com/leverdeterre/MediaPickerManager.git",
        "tag": "0.0.4"
    },
    "source_files": "GenericPickerManager/MediaPickerManager/*.{h,m}",
    "frameworks": "MobileCoreServices",
    "resources": "GenericPickerManager/MediaPickerManager/MediaPickerManager.bundle"
}

Pin It on Pinterest

Share This