ios上传图片,图片压缩,相机连拍。

简单的进行调用:
– (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{

__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_Demo :https://github.com/yuanchuns/YC-ZLPhotoLib-takePhoto

    原文作者:Eidesen
    原文地址: https://segmentfault.com/a/1190000003091280
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞