Commit e60ab198 authored by 翟书觅's avatar 翟书觅

滑动切换预览,UI和完成按钮交互是否可用的设置

parent 989439b1
...@@ -487,7 +487,7 @@ ...@@ -487,7 +487,7 @@
TargetAttributes = { TargetAttributes = {
900E657B1C2BB8D5003D9A9E = { 900E657B1C2BB8D5003D9A9E = {
CreatedOnToolsVersion = 7.2; CreatedOnToolsVersion = 7.2;
DevelopmentTeam = LTFQDC2QVX; DevelopmentTeam = JYK5L225PH;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
900E65941C2BB8D5003D9A9E = { 900E65941C2BB8D5003D9A9E = {
...@@ -799,7 +799,7 @@ ...@@ -799,7 +799,7 @@
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = LTFQDC2QVX; DEVELOPMENT_TEAM = JYK5L225PH;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
...@@ -808,7 +808,7 @@ ...@@ -808,7 +808,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.3.2; MARKETING_VERSION = 3.3.2;
PRODUCT_BUNDLE_IDENTIFIER = tanzhenios2019.TZImagePickerController.www; PRODUCT_BUNDLE_IDENTIFIER = zsmios2020.TZImagePickerController.www;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
...@@ -823,7 +823,7 @@ ...@@ -823,7 +823,7 @@
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = LTFQDC2QVX; DEVELOPMENT_TEAM = JYK5L225PH;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/TZImagePickerController", "$(PROJECT_DIR)/TZImagePickerController",
...@@ -832,7 +832,7 @@ ...@@ -832,7 +832,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.3.2; MARKETING_VERSION = 3.3.2;
PRODUCT_BUNDLE_IDENTIFIER = tanzhenios2019.TZImagePickerController.www; PRODUCT_BUNDLE_IDENTIFIER = zsmios2020.TZImagePickerController.www;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
@interface TZAssetPreviewCell : UICollectionViewCell @interface TZAssetPreviewCell : UICollectionViewCell
@property (nonatomic, strong) TZAssetModel *model; @property (nonatomic, strong) TZAssetModel *model;
@property (nonatomic, copy) void (^singleTapGestureBlock)(void); @property (nonatomic, copy) void (^singleTapGestureBlock)(void);
- (void)configSubviews; - (void)configSubviews;
- (void)photoPreviewCollectionViewDidScroll; - (void)photoPreviewCollectionViewDidScroll;
@end @end
...@@ -38,7 +39,6 @@ ...@@ -38,7 +39,6 @@
@property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *imageContainerView; @property (nonatomic, strong) UIView *imageContainerView;
@property (nonatomic, strong) TZProgressView *progressView; @property (nonatomic, strong) TZProgressView *progressView;
@property (nonatomic, strong) UIView *iCloudErrorView; // iCloud加载失败提示View
@property (nonatomic, assign) BOOL allowCrop; @property (nonatomic, assign) BOOL allowCrop;
@property (nonatomic, assign) CGRect cropRect; @property (nonatomic, assign) CGRect cropRect;
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
@property (nonatomic, strong) id asset; @property (nonatomic, strong) id asset;
@property (nonatomic, copy) void (^singleTapGestureBlock)(void); @property (nonatomic, copy) void (^singleTapGestureBlock)(void);
@property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress); @property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);
@property (nonatomic, copy) void (^iCloudSyncFailedBlock)(BOOL hidden); // iCloud同步失败回调
@property (nonatomic, strong) UIImageView *icloudErrorIcon;
@property (nonatomic, strong) UILabel *icloudErrorLB;
@property (nonatomic, assign) int32_t imageRequestID; @property (nonatomic, assign) int32_t imageRequestID;
...@@ -62,6 +65,7 @@ ...@@ -62,6 +65,7 @@
@property (strong, nonatomic) UIImage *cover; @property (strong, nonatomic) UIImage *cover;
@property (nonatomic, strong) NSURL *videoURL; @property (nonatomic, strong) NSURL *videoURL;
- (void)pausePlayerAndShowNaviBar; - (void)pausePlayerAndShowNaviBar;
@property (nonatomic, copy) void (^iCloudSyncFailedBlock)(BOOL hidden); // iCloud同步失败回调
@end @end
......
...@@ -134,19 +134,18 @@ ...@@ -134,19 +134,18 @@
_imageView.clipsToBounds = YES; _imageView.clipsToBounds = YES;
[_imageContainerView addSubview:_imageView]; [_imageContainerView addSubview:_imageView];
_iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 : 64, self.tz_width, 28)]; _icloudErrorIcon = [[UIImageView alloc] init];
UIImageView *icloud = [[UIImageView alloc] init]; _icloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"]; _icloudErrorIcon.hidden = YES;
icloud.frame = CGRectMake(10, 0, 28, 28); [self addSubview:_icloudErrorIcon];
[_iCloudErrorView addSubview:icloud]; _icloudErrorLB = [[UILabel alloc] init];
UILabel *label = [[UILabel alloc] init]; _icloudErrorLB.font = [UIFont systemFontOfSize:10];
label.frame = CGRectMake(40, 0, self.tz_width - 50, 28); _icloudErrorLB.textColor = [UIColor whiteColor];
label.font = [UIFont systemFontOfSize:10]; _icloudErrorLB.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
label.textColor = [UIColor whiteColor]; _icloudErrorLB.hidden = YES;
label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"]; [self addSubview:_icloudErrorLB];
[_iCloudErrorView addSubview:label];
[self addSubview:_iCloudErrorView];
_iCloudErrorView.hidden = YES;
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)]; UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
[self addGestureRecognizer:tap1]; [self addGestureRecognizer:tap1];
...@@ -174,9 +173,17 @@ ...@@ -174,9 +173,17 @@
// 先显示缩略图 // 先显示缩略图
[[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) { if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
self.iCloudErrorView.hidden = NO; if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
self->_icloudErrorLB.hidden = NO;
self->_icloudErrorIcon.hidden = NO;
} else { } else {
self.iCloudErrorView.hidden = YES; if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
self->_icloudErrorLB.hidden = YES;
self->_icloudErrorIcon.hidden = YES;
} }
self.imageView.image = photo; self.imageView.image = photo;
[self resizeSubviews]; [self resizeSubviews];
...@@ -223,12 +230,20 @@ ...@@ -223,12 +230,20 @@
_asset = asset; _asset = asset;
self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (![asset isEqual:self->_asset]) return;
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) { if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
self.iCloudErrorView.hidden = NO; if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
self->_icloudErrorLB.hidden = NO;
self->_icloudErrorIcon.hidden = NO;
} else { } else {
self.iCloudErrorView.hidden = YES; if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
self->_icloudErrorLB.hidden = YES;
self->_icloudErrorIcon.hidden = YES;
} }
if (![asset isEqual:self->_asset]) return;
self.imageView.image = photo; self.imageView.image = photo;
[self resizeSubviews]; [self resizeSubviews];
if (self.imageView.tz_height && self.allowCrop) { if (self.imageView.tz_height && self.allowCrop) {
...@@ -337,8 +352,9 @@ ...@@ -337,8 +352,9 @@
CGFloat progressX = (self.tz_width - progressWH) / 2; CGFloat progressX = (self.tz_width - progressWH) / 2;
CGFloat progressY = (self.tz_height - progressWH) / 2; CGFloat progressY = (self.tz_height - progressWH) / 2;
_progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH); _progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH);
[self recoverSubviews]; [self recoverSubviews];
_icloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, 28, 28);
_icloudErrorLB.frame = CGRectMake(53, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.tz_width - 63, 28);
} }
#pragma mark - UITapGestureRecognizer Event #pragma mark - UITapGestureRecognizer Event
...@@ -428,6 +444,15 @@ ...@@ -428,6 +444,15 @@
if (self.model && self.model.asset) { if (self.model && self.model.asset) {
[[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
if (!photo && [info[PHImageResultIsInCloudKey] boolValue]) {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(NO);
}
} else {
if (self.iCloudSyncFailedBlock) {
self.iCloudSyncFailedBlock(YES);
}
}
self.cover = photo; self.cover = photo;
}]; }];
[[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) { [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
@property (nonatomic, assign) double progress; @property (nonatomic, assign) double progress;
@property (strong, nonatomic) UIAlertController *alertView; @property (strong, nonatomic) UIAlertController *alertView;
@property (nonatomic, strong) UIView *iCloudErrorView;
@end @end
@implementation TZPhotoPreviewController @implementation TZPhotoPreviewController
...@@ -459,8 +460,19 @@ ...@@ -459,8 +460,19 @@
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) { if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZVideoPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZVideoPreviewCell" forIndexPath:indexPath];
// TZVideoPreviewCell *videoPreviewCell = (TZVideoPreviewCell *)cell;
// videoPreviewCell.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
} else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) { } else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZGifPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZGifPreviewCell" forIndexPath:indexPath];
// TZGifPreviewCell *gifPreviewCell = (TZGifPreviewCell *)cell;
// gifPreviewCell.previewView.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
} else { } else {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZPhotoPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZPhotoPreviewCell" forIndexPath:indexPath];
TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell; TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell;
...@@ -485,6 +497,10 @@ ...@@ -485,6 +497,10 @@
} }
} }
}]; }];
// photoPreviewCell.previewView.iCloudSyncFailedBlock = ^(BOOL hidden) {
// weakSelf.iCloudErrorView.hidden = hidden;
// self->_doneButton.enabled = hidden;
// };
} }
cell.model = model; cell.model = model;
...@@ -492,6 +508,7 @@ ...@@ -492,6 +508,7 @@
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
[strongSelf didTapPreviewCell]; [strongSelf didTapPreviewCell];
}]; }];
return cell; return cell;
} }
...@@ -588,4 +605,24 @@ ...@@ -588,4 +605,24 @@
return [TZCommonTools tz_isRightToLeftLayout] ? self.models.count - _currentIndex - 1 : _currentIndex; return [TZCommonTools tz_isRightToLeftLayout] ? self.models.count - _currentIndex - 1 : _currentIndex;
} }
//#pragma mark - lazy
//- (UIView *)iCloudErrorView{
// if (!_iCloudErrorView) {
// _iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.view.tz_width, 28)];
// UIImageView *icloud = [[UIImageView alloc] init];
// icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
// icloud.frame = CGRectMake(20, 0, 28, 28);
// [_iCloudErrorView addSubview:icloud];
// UILabel *label = [[UILabel alloc] init];
// label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);
// label.font = [UIFont systemFontOfSize:10];
// label.textColor = [UIColor whiteColor];
// label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
// [_iCloudErrorView addSubview:label];
// [self.view addSubview:_iCloudErrorView];
// _iCloudErrorView.hidden = YES;
// }
// return _iCloudErrorView;
//}
@end @end
...@@ -224,13 +224,13 @@ ...@@ -224,13 +224,13 @@
#pragma mark - lazy #pragma mark - lazy
- (UIView *)iCloudErrorView{ - (UIView *)iCloudErrorView{
if (!_iCloudErrorView) { if (!_iCloudErrorView) {
_iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 : 64, self.view.tz_width, 28)]; _iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.view.tz_width, 28)];
UIImageView *icloud = [[UIImageView alloc] init]; UIImageView *icloud = [[UIImageView alloc] init];
icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"]; icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
icloud.frame = CGRectMake(10, 0, 28, 28); icloud.frame = CGRectMake(20, 0, 28, 28);
[_iCloudErrorView addSubview:icloud]; [_iCloudErrorView addSubview:icloud];
UILabel *label = [[UILabel alloc] init]; UILabel *label = [[UILabel alloc] init];
label.frame = CGRectMake(40, 0, self.view.tz_width - 50, 28); label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);
label.font = [UIFont systemFontOfSize:10]; label.font = [UIFont systemFontOfSize:10];
label.textColor = [UIColor whiteColor]; label.textColor = [UIColor whiteColor];
label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"]; label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
......
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