Skip to content

A profile image selection view controller supporting image selection and editing behavior like in the contacts app.

License

Notifications You must be signed in to change notification settings

dan085/MMSProfileImagePicker

 
 

Repository files navigation

MMSProfileImagePicker

CI Status Version License Platform Readme Score

This class provides the capabilities for selecting an image from the photo library or camera, or submitting one for editing in a circular mask. The selected and edited image would typically be used for a profile displayed in a circle. With this class an application can provide identical profile selection features found in the contacts app.

Example

## Basic Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Import the class header.

# import "MMSProfileImagePicker.h"

Create a the profile picker object. The application's view controller implements the MMSProfileImagePickerDelegate interface. The interface's method is where profile picker passes the selected and edited image. Before calling one of the profile picker's methods, the application sets its delegate property.

- (IBAction)pickFromCamera {

    profilePicker = [[MMSProfileImagePicker alloc] init];

    profilePicker.delegate = self;

    [profilePicker selectFromCamera:self];

}

There are three public methods for selecting and editing a profile image. For editing an existing image call...

-(void)presentEditScreen:(UIViewController* _Nonnull)vc withImage:(UIImage* _Nonnull)image;

For editing an image selected from the photo library call...

-(void)selectFromPhotoLibrary:(UIViewController* _Nonnull)vc;

For editing an image selected from the camera call...

-(void)selectFromCamera:(UIViewController* _Nonnull)vc;

To receive the selected and edited image implement the delegate method...

-(void)mmsImagePickerController:(MMSProfileImagePicker* _Nonnull)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString*, id>*_Nonnull)info;

The dictionary parameter supports all the editing information keys defined in editing information keys found in the iOS developer documentation.

If the user cancels the selection, the application receives notificaton on the delegate method...

-(void)mmsImagePickerControllerDidCancel:(MMSProfileImagePicker * _Nonnull)picker;

Requirements

MMSProfileImagePicker requires iOS 7.2 or later.

Installation

MMSProfileImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MMSProfileImagePicker"

Article

An article describing the implementation of the class: A Class for Selecting a Profile Image.

A related article describing the cropping category: A View Class for Cropping Images.

Author

William Miller, [email protected]

License

This project is is available under the MIT license. See the LICENSE file for more info. Add attibution by linking to the project page is appreciated.

About

A profile image selection view controller supporting image selection and editing behavior like in the contacts app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 63.8%
  • Swift 23.5%
  • Shell 11.4%
  • Ruby 1.3%