当前位置

网站首页> 程序设计 > 开源项目 > 程序开发 > 浏览文章

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

作者:小梦 来源: 网络 时间: 2024-06-07 阅读:

简单的进行调用:
- (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

热点阅读

网友最爱