HHAssetsCarouselItemView depends on this repo: HHAttachmentSheetView, click this link to see more detail about how to use HHAttachmentSheetView
in your own project.
HHAssetsCarouselItemView enables you to pick a assets in your Photo Library like Messages app.
For more details: blog.coderhr.com
- Pick a assets in your Photo Library like Messages app.
- Xcode7 or higher
- iOS 6.0 or higher
- ARC
- Objective-C
pod "HHAssetsCarouselItemView"
Open and run the HHAssetsCarouselItemViewDemo.xcworkspace
in Xcode to see HHAssetsCarouselItemView in action
NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:5];
HHAssetsCarouselItemView *assetsItem = [[HHAssetsCarouselItemView alloc] initWithCamera:NO selfPortrait:NO forProfilePhoto:NO assetType:TGMediaAssetPhotoType];
assetsItem.delegate = self;
[items addObject:assetsItem];
[items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"Choose Photo" pressed:^ {
NSLog(@"choose photo");
}]];
[items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"Take Photo" pressed:^ {
NSLog(@"choose viedo");
}]];
[items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"Search Photo" pressed:^ {
NSLog(@"search photo");
}]];
HHAttachmentSheetButtonItemView *cancelItem = [[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"Cancel" pressed:nil];
cancelItem.bold = YES;
[items addObject:cancelItem];
_sheetView = [[HHAttachmentSheetView alloc] initWithItems:items];
[_sheetView showWithAnimate:YES completion:nil];
__weak ViewController *weakSelf = self;
__weak HHAttachmentSheetView *weakSheetView = _sheetView;
__weak HHAssetsCarouselItemView *weakItemView = assetsItem;
assetsItem.sendPressed = ^ (TGMediaAsset *assets) {
__strong HHAttachmentSheetView *strongSheetView = weakSheetView;
__strong HHAssetsCarouselItemView *strongItemView = weakItemView;
[strongSheetView hideWithAnimate:YES completion:nil];
TGMediaAsset *asset = [strongItemView.selectionContext.selectedItems firstObject];
[[TGMediaAssetImageSignals imageForAsset:asset imageType:TGMediaAssetImageTypeLargeThumbnail size:CGSizeMake(200, 200)] startWithNext:^(UIImage *image) {
if ([image isKindOfClass:[UIImage class]]) {
weakSelf.imageView.image = image;
}
} completed:nil];
};
- Add more assets type like gif and video.
- Add CameraPreivew.
- Add Carthage support.
- First commit, support for CocoaPods.
HHAttachmentSheetView
is available under the MIT license. See the LICENSE file for more info.