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

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

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