Latest 1.5.0
Homepage https://github.com/miller-ms/MMSProfileImagePicker
License MIT
Platforms ios 9.0, requires ARC
Dependencies MMSCameraViewController
Frameworks UIKit, AVFoundation, CoreMedia, ImageIO
Authors

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.

Latest podspec

{
    "name": "MMSProfileImagePicker",
    "version": "1.5.0",
    "summary": "A profile image selection view controller supporting image selection and editing behavior like in the contacts app.",
    "description": "This class supports the feature for selecting an image from the photo library or camera for use as a profile image. Before final selection, it presents an edit screen with a circle overalay to resize and position the image for cropping in a square whose side is the length of the circle's diameter.  An image can be submitted to the class for editing only.  With this class you can emulate the features of the contact app's profile image selection.",
    "homepage": "https://github.com/miller-ms/MMSProfileImagePicker",
    "license": "MIT",
    "authors": {
        "William Miller": "[email protected]"
    },
    "source": {
        "git": "https://github.com/miller-ms/MMSProfileImagePicker.git",
        "tag": "1.5.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": [
        "Pod/Classes/**/*",
        "Pod/Assets/**/*"
    ],
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": [
        "UIKit",
        "AVFoundation",
        "CoreMedia",
        "ImageIO"
    ],
    "dependencies": {
        "MMSCameraViewController": [
            "~> 1.2.1"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This