在项目上总会遇到上传用户头像的功能,上传的时候图片过大造成用户体验不是太好,需要对图片进行剪切达到快速上传的用户体验. 简单介绍一个第三方TZImagePickerController.如何添加到项目不再介绍.......
使用代码
导入头文件 并实现代理>>>>> TZImagePickerControllerDelegate
#import "TZImagePickerController.h"
#import "TZAssetModel.h"
#import "TZImageManager.h"
点击按钮的操作如下:
TZImagePickerController *pickerController = [[TZImagePickerController alloc]initWithMaxImagesCount:1 columnNumber:6 delegate:self pushPhotoPickerVc:YES]; pickerController.allowCrop = YES; pickerController.needCircleCrop = YES; pickerController.circleCropRadius = 120; [pickerController setDidFinishPickingPhotosHandle:^(NSArray*photo, NSArray * assets, BOOL isSelectOriginalPhoto) {
// self.selectArray= photo.mutableCopy;
self.imgView.image=photo.lastObject; //图片剪切后的展示
NSLog(@"photo 图片剪切== %@, assets == %@",photo,assets);
}];
[self presentViewController:pickerController animated:YES completion:nil];
网友评论