Commit 81715d3e authored by hanling's avatar hanling

当设备性能较差时,裁剪图片有一定概率闪退

parent cf4b7b42
...@@ -382,16 +382,23 @@ ...@@ -382,16 +382,23 @@
[_tzImagePickerVc addSelectedModel:model]; [_tzImagePickerVc addSelectedModel:model];
} }
if (_tzImagePickerVc.allowCrop) { // 裁剪状态 if (_tzImagePickerVc.allowCrop) { // 裁剪状态
TZImagePickerController *rootVc = self.navigationController;
[rootVc showProgressHUD];
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:_currentIndex inSection:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForItem:_currentIndex inSection:0];
TZPhotoPreviewCell *cell = (TZPhotoPreviewCell *)[_collectionView cellForItemAtIndexPath:indexPath]; TZPhotoPreviewCell *cell = (TZPhotoPreviewCell *)[_collectionView cellForItemAtIndexPath:indexPath];
UIImage *cropedImage = [TZImageCropManager cropImageView:cell.previewView.imageView toRect:_tzImagePickerVc.cropRect zoomScale:cell.previewView.scrollView.zoomScale containerView:self.view]; dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (_tzImagePickerVc.needCircleCrop) { UIImage *cropedImage = [TZImageCropManager cropImageView:cell.previewView.imageView toRect:_tzImagePickerVc.cropRect zoomScale:cell.previewView.scrollView.zoomScale containerView:self.view];
cropedImage = [TZImageCropManager circularClipImage:cropedImage]; if (_tzImagePickerVc.needCircleCrop) {
} cropedImage = [TZImageCropManager circularClipImage:cropedImage];
if (self.doneButtonClickBlockCropMode) { }
TZAssetModel *model = _models[_currentIndex]; dispatch_async(dispatch_get_main_queue(), ^{
self.doneButtonClickBlockCropMode(cropedImage,model.asset); [rootVc hideProgressHUD];
} if (self.doneButtonClickBlockCropMode) {
TZAssetModel *model = _models[_currentIndex];
self.doneButtonClickBlockCropMode(cropedImage,model.asset);
}
});
});
} else if (self.doneButtonClickBlock) { // 非裁剪状态 } else if (self.doneButtonClickBlock) { // 非裁剪状态
self.doneButtonClickBlock(_isSelectOriginalPhoto); self.doneButtonClickBlock(_isSelectOriginalPhoto);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment