![Platform](https://camo.githubusercontent.com/96af89f5fb6c6a79da8f82fa6b7202da57f568ebd14cf118fdc7407023d8948e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506c6174666f726d2d253230694f532532302d626c75652e737667)
- IRPhotoGallery is a powerful photo gallery for iOS.
- Support multiple gallery modes.
- Horizontal
- Vertical
- Normal
- Deletable
- Scalable
- HasButton
- NoButton
- Full screen gallery.
- Customable functions.
- Amazing camera.
- Git clone this project.
- Copy this project into your own project.
- Add the .xcodeproj into you project and link it as embed framework.
- You can remove the
demo
and ScreenShots
folder.
- Add
pod 'IRPhotoGallery'
in the Podfile
pod install
- Use
PhotoManageViewController
, it include multi parts: Gallery, Preview, Camera, Album, Filters, etc...
NSBundle *bundle = [NSBundle bundleForClass:[PhotoManageViewController class]];
photoManageViewController = [[PhotoManageViewController alloc] initWithNibName:@"PhotoManageViewController" bundle:bundle];
photoManageViewController.delegate = self;
photoManageViewController.cameraDelegate = self;
[IRCameraColor setTintColor: [UIColor whiteColor]];
[self.navigationController pushViewController:photoManageViewController animated:YES];
- Use
PhotoManageBrowser
, it just a gallery view
photoManageBrowser = [[PhotoManageBrowser alloc] init];
[photoManageBrowser setStyle:Normal];
[photoManageBrowser setDirection:ScrollDirectionHorizontal];
__weak ViewController* wSelf = self;
[photoManageBrowser setItemSelectedBlock:^(NSIndexPath *indexPath) {
NSBundle *bundle = [NSBundle bundleForClass:[PhotoGalleryViewController class]];
PhotoGalleryViewController* photoGalleryViewController = [[PhotoGalleryViewController alloc] initWithNibName:@"PhotoGalleryViewController" bundle:bundle];
photoGalleryViewController.delegate = wSelf;
photoGalleryViewController.imageIndex = indexPath.row;
[wSelf presentViewController:photoGalleryViewController animated:YES completion:nil];
}];
photoManageBrowser.delegate = self;
[self.view addSubview:photoManageBrowser];
PhotoManageViewController |
Normal |
Deletable |
Scalable |
[photoManageBrowser setStyle:Normal];
PhotoManageBrowserScrollDirection |
ScrollDirectionVertical |
ScrollDirectionHorizontal |
[photoManageBrowser setDirection:ScrollDirectionHorizontal];
#pragma mark - PhotoManageBrowserDelegate
- (NSUInteger)numberOfPhotos {
return photos.count;
}
- (NSString *)titleOfPhotoWithIndex:(NSInteger)index {
return [photos objectAtIndex:index].note;
}
- (id)imageOrPathStringOfPhotoWithIndex:(NSInteger)index {
return [images objectAtIndex:index];
}
#pragma mark - CameraViewControllerDelegate
- (void)didTakePhoto:(UIImage *)image Note:(NSString *)note {
Photo *photo = [NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:context];
photo.photo = UIImagePNGRepresentation(image);
photo.note = note;
[(AppDelegate *)[[UIApplication sharedApplication] delegate] saveContext];
[self reloadPhotos];
[photoManageViewController reloadUI];
}
- (void)doUpdatePhoto:(UIImage *)image Note:(NSString *)note Completed:(nullable IRCompletionBlock)completedBlock {
[photoManageViewController showLoading:YES];
NSInteger index = [images indexOfObject:image];
Photo *photo = [photos objectAtIndex:index];
photo.photo = UIImagePNGRepresentation(image);
photo.note = note;
[(AppDelegate *)[[UIApplication sharedApplication] delegate] saveContext];
if (completedBlock) {
completedBlock(YES);
}
[photoManageViewController reloadUI];
[photoManageViewController showLoading:NO];
}
- (void)doDeletePhoto:(UIImage *)image {
NSInteger index = [images indexOfObject:image];
Photo *photo = [photos objectAtIndex:index];
[context deleteObject:photo];
[(AppDelegate *)[[UIApplication sharedApplication] delegate] saveContext];
[self reloadPhotos];
[photoManageViewController reloadUI];
}
- Customize functions of
PhotoManageBrowser
, 4 blocks let you override the default feature
@property (nonatomic, copy) CurrentPageChangedBlock currentPageChangedBlock;
@property (nonatomic, copy) ItemSelectedBlock itemSelectedBlock;
@property (nonatomic, copy) DeleteClickBlock deleteClickBlock;
@property (nonatomic, copy) EditClickBlock editClickBlock;
- Use
PhotoGalleryViewController
, it is a simple gallery view controller
NSBundle *bundle = [NSBundle bundleForClass:[PhotoGalleryViewController class]];
PhotoGalleryViewController* photoGalleryViewController = [[PhotoGalleryViewController alloc] initWithNibName:@"PhotoGalleryViewController" bundle:bundle];
photoGalleryViewController.delegate = wSelf;
photoGalleryViewController.imageIndex = indexPath.row;
[wSelf presentViewController:photoGalleryViewController animated:YES completion:nil];
PhotoManageViewController |
PhotoManageBrowser |
![PhotoManageViewController](./ScreenShots/demo1.png) |
![PhotoManageBrowser](./ScreenShots/demo2.png) |
Camera |
Album |
![Camera](./ScreenShots/demo3.png) |
![Album](./ScreenShots/demo4.png) |
PhotoGalleryViewController |
Full Screen Gallery |
![PhotoGalleryViewController](./ScreenShots/demo5.png) |
![Full Screen Gallery](./ScreenShots/demo6.png) |