CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A UIImagePickerController-like assets picker that utilizes ARMultiSelectGestureRecognizer for swipe-to-select
The easiest way to add ARSwipeToSelectPickerController to your project is via CocoaPods:
pod 'ARSwipeToSelectPickerController'
Alternatively you could copy all the files in the Classes/ directory into your project. Be sure 'Copy items to destination group's folder' is checked.
#import "ARSwipeToSelectPickerController.h"
ARSwipeToSelectPickerControllerDelegate protocol,
implement its delegate methods
ARSwipeToSelectPickerController *picker = [[ARSwipeToSelectPickerController alloc] initWithDelegate:self];
[self.navigationController pushViewController:picker animated:YES];You can also show the picker modally by embedding it inside a UINavigationController first:
ARSwipeToSelectPickerController *picker = [[ARSwipeToSelectPickerController alloc] initWithDelegate:self];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:picker];
[self presentViewController:nav animated:YES completion:nil];#pragma mark - ARSwipeToSelectPickerControllerDelegate methods
- (void) swipeToSelectPickerControllerDidCancel:(ARSwipeToSelectPickerController *)sender
{
// use popViewControllerAnimated if using navigation controller for viewcontroller stack
//[self.navigationController popViewControllerAnimated:YES];
// use dismissViewControllerAnimated if not using a navigation controller
//[self dismissViewControllerAnimated:YES completion:nil];
}
- (void) swipeToSelectPickerController:(ARSwipeToSelectPickerController *)sender didFinishPickingMediaWithAssets:(NSArray *)assets
{
// Use MWPhotoBrowser to show the selected photos
[self dismissViewControllerAnimated:NO completion:^{
NSMutableArray *tmpArray = [[NSMutableArray alloc] initWithCapacity:[assets count]];
[assets enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
UIImage *image = [UIImage imageWithCGImage:[[((ALAsset *) obj) defaultRepresentation] fullScreenImage]];
[tmpArray addObject:[MWPhoto photoWithImage:image]];
}];
self.photos = tmpArray;
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
browser.displayActionButton = NO;
[browser setInitialPageIndex:0];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:browser animated:YES completion:nil];
});
}];
}Or if you are inside a UINavigationController stack, do something like the following to dismiss the picker controller:
[self.navigationController popToViewController:self animated:YES];A cool demo can be found in the demo folder!