Latest | 1.0.0 |
---|---|
Homepage | https://github.com/sadiq81/HGImagePicker |
License | MIT |
Platforms | ios 8.0, requires ARC |
Dependencies | AsyncImageView, CTAssetsPickerController, pop, MSSPopMasonry, ALActionBlocks, LinqToObjectiveC, ReactiveCocoa |
Frameworks | UIKit, AssetsLibrary |
Authors |
Ever wonted an image picker that allows you to easily add images from the Camera roll, Camera and Photo library
then you need not look any further.
HGImagepicker combines a list of recent pictures with CTAssetsPickerController and Apples UIImagePickerController
to mimic the same behaviour of the Messages app.
Usage
There are some string localization resources and some image resources you need to have in your project
Example of english string localization:
"HGImagePickerView.button.approve" = "Add 1 picture";
"HGImagePickerView.button.approve.multiple" = "Add %lu pictures";
"HGImagePickerView.button.photoLibrary" = "Photo library";
"HGImagePickerView.button.takePicture" = "Take picture";
"HGImagePickerView.button.cancel" = "Regret";
"HGImagePickerController.button.confirm" = "Approve";
"HGImagePickerController.button.cancel" = "Regret";
"HGImagePickerController.label.no.pictures" = "You have not added any pictures, press the camera to add pictures";
"HGImagePickerController.label.max.pictures" = "You can choose a maximum of %i picture(s)";
List of image resources:
HGImagePickerController.UIBarButtonImage.Camera
HGImagePickerController.UIBarButtonImage.Trash
HGPictureCollectionViewCell.Selected
See the example project for image examples, note that the images included in the sample is Copyright protected so you need to find you own images.
Display HGImagePickerController
HGImagePickerController *imagePickerController = [HGImagePickerController controllerWithDelegate:self];
imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:imagePickerController animated:true completion:nil];
Delegate callback when the user confirms the choice of images
- (void)HGImagePickerControllerDidConfirm:(HGImagePickerController *)controller pictures:(NSArray *)pictures {
@weakify(self)
[controller dismissViewControllerAnimated:true completion:^{
@strongify(self)
[self.slideShow setImages:[[NSMutableArray alloc] initWithArray:pictures]];
[self.slideShow start];
}];
}
Delegate callback when the user cancels
- (void)HGImagePickerControllerDidCancel:(HGImagePickerController *)controller {
@weakify(self)
[controller dismissViewControllerAnimated:true completion:^{
@strongify(self)
UIAlertController *errorController = [UIAlertController alertControllerWithTitle:@"Cancelled" message:@"User cancelled image picking" preferredStyle:UIAlertControllerStyleAlert];
[errorController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
[self presentViewController:errorController animated:true completion:nil];
}];
}
Thanks to the creators of AsyncImageView, CTAssetsPickerController, MSSPopMasonry, ALActionBlocks, LinqToObjectiveC, ReactiveCocoa
Requirements
Installation
HGImagePicker is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod "HGImagePicker"
Author
Tommy Sadiq Hinrichsen, [email protected]
License
HGImagePicker is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "HGImagePicker", "version": "1.0.0", "summary": "An image picker similar to Apples picker in the messages app.", "description": " Ever wonted an image picker that allows you to easily add images from the Camera roll, Camera and Photo libraryn then you need not look any further.nn HGImagepicker combines a list of recent pictures with CTAssetsPickerController and Apples UIImagePickerControllern to mimic the same behaviour of the Messages app.nn n n nn Example:nnDisplay HGImagePickerController
n ```Objective-Cn HGImagePickerController *imagePickerController = [HGImagePickerController controllerWithDelegate:self];n imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;n imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;n [self presentViewController:imagePickerController animated:true completion:nil];n ```nn
Delegate callback when the user confirms the choice of images
n ```Objective-Cn - (void)HGImagePickerControllerDidConfirm:(HGImagePickerController *)controller pictures:(NSArray *)pictures {n @weakify(self)n [controller dismissViewControllerAnimated:true completion:^{n @strongify(self)n [self.slideShow setImages:[[NSMutableArray alloc] initWithArray:pictures]];n [self.slideShow start];n }];n }n ```n
Delegate callback when the user cancels
n ```Objective-Cn - (void)HGImagePickerControllerDidCancel:(HGImagePickerController *)controller {n @weakify(self)n [controller dismissViewControllerAnimated:true completion:^{n @strongify(self)n UIAlertController *errorController = [UIAlertController alertControllerWithTitle:@"Cancelled" message:@"User cancelled image picking" preferredStyle:UIAlertControllerStyleAlert];n [errorController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];n [self presentViewController:errorController animated:true completion:nil];nn }];n }n ```nn Thanks to the creators of AsyncImageView, CTAssetsPickerController, MSSPopMasonry, ALActionBlocks, LinqToObjectiveC, ReactiveCocoann", "homepage": "https://github.com/sadiq81/HGImagePicker", "license": "MIT", "authors": { "Tommy Sadiq Hinrichsen": "[email protected]" }, "source": { "git": "https://github.com/sadiq81/HGImagePicker.git", "tag": "1.0.0" }, "social_media_url": "https://twitter.com/sadiq81", "platforms": { "ios": "8.0" }, "requires_arc": true, "source_files": "Pod/Classes/**/*", "resource_bundles": { "HGImagePicker": [ "Pod/Assets/*.png" ] }, "frameworks": [ "UIKit", "AssetsLibrary" ], "dependencies": { "AsyncImageView": [ "~> 1.5.1" ], "CTAssetsPickerController": [ "~> 2.9.3" ], "pop": [ "~> 1.0" ], "MSSPopMasonry": [ "~> 0.0.1" ], "ALActionBlocks": [ "~> 1.0.3" ], "LinqToObjectiveC": [ "~> 2.0.0" ], "ReactiveCocoa": [ "~> 2.4.7" ] } }
Tue, 01 Mar 2016 01:26:03 +0000