sadiq81

1pod
你是否曾想过需要一个能够轻松从相册、相机和图片库中添加图片的图片选择器,那么你无需再寻找其他工具。
HGImagepicker通过结合最近图片列表与CTAssetsPickerController和Apples UIImagePickerController来模拟消息应用的相同行为。
示例
显示HGImagePickerController Objective-C HGImagePickerController *imagePickerController = [HGImagePickerController controllerWithDelegate:self]; imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen; imagePickerController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentViewController:imagePickerController animated:true completion:nil];
当用户确认选择图片时的代理回调 Objective-C - (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]; }]; }
当用户取消时的代理回调 ```Objective-C - (void)HGImagePickerControllerDidCancel:(HGImagePickerController *)controller { @weakify(self) [controller dismissViewControllerAnimated:true completion:^{ @strongify(self) UIAlertController *errorController = [UIAlertController alertControllerWithTitle:@"已取消" message:@"用户已取消图片选择" preferredStyle:UIAlertControllerStyleAlert]; [errorController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; [self presentViewController:errorController animated:true completion:nil];
}];
} ```
感谢AsyncImageView、CTAssetsPickerController、MSSPopMasonry、ALActionBlocks、LinqToObjectiveC、ReactiveCocoa的制作者
许可证: MIT