簡單的進行調用:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{git
__weak publishInforMationViewController *weakSelf =self; if (buttonIndex == 0) { if (![CommonTool isAllowTakePhoto]) { NoPictureViewController *vc = [[NoPictureViewController alloc]init]; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; [self presentViewController:nav animated:YES completion:^{ }]; return; } ZLCameraViewController *cameraVc = [[ZLCameraViewController alloc] init]; cameraVc.maxCount = 9 - self.arrImage.count; NSMutableArray *arr =[NSMutableArray array]; // 多選相冊+相機多拍 回調 [cameraVc startCameraOrPhotoFileWithViewController:self complate:^(NSArray *object) { // 選擇完照片、拍照完回調 [object enumerateObjectsUsingBlock:^(id asset, NSUInteger idx, BOOL *stop) { if ([asset isKindOfClass:[ZLCamera class]]) { [arr addObject:asset]; }else{ [arr addObject:asset]; } }]; for (int i=0; i<arr.count; i++) { ZLPhotoAssets *asset = arr[i]; UIImage *image = asset.thumbImage; [weakSelf.arrImage addObject:image]; } [weakSelf reloadScrollView:weakSelf.arrImage]; }]; self.cameraVc = cameraVc; } if (buttonIndex == 1) { if (![CommonTool isAllowPhoto]) { NoPictureViewController *vc = [[NoPictureViewController alloc]init]; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; [self presentViewController:nav animated:YES completion:^{ }]; return; } ZLPhotoPickerViewController *pickerVc = [[ZLPhotoPickerViewController alloc] init]; pickerVc.minCount = 9 - self.arrImage.count; pickerVc.status = PickerViewShowStatusCameraRoll; pickerVc.callBack = ^(NSArray *status){ for (int i=0; i<status.count; i++) { [weakSelf.arrImage addObject:[status[i]originImage]]; } [weakSelf reloadScrollView:weakSelf.arrImage]; }; [pickerVc showPickerVc:self]; }
}github
github_Demo :https://github.com/yuanchuns/YC-ZLPhotoLib-takePhotocode