Commit b2a0b938f6d610d7a9ffc5062137ce73a51d72f2
1 parent
5abd0c15
提交
Showing
13 changed files
with
524 additions
and
425 deletions
CNLiveImagePickerController.podspec
| ... | ... | @@ -8,8 +8,8 @@ |
| 8 | 8 | |
| 9 | 9 | Pod::Spec.new do |s| |
| 10 | 10 | s.name = 'CNLiveImagePickerController' |
| 11 | - s.version = '0.1.0' | |
| 12 | - s.summary = 'A short description of CNLiveImagePickerController.' | |
| 11 | + s.version = '0.1.1' | |
| 12 | + s.summary = '相册' | |
| 13 | 13 | |
| 14 | 14 | # This description is used to generate tags and improve search results. |
| 15 | 15 | # * Think: What does it do? Why did you write it? What is the focus? |
| ... | ... | @@ -21,16 +21,19 @@ Pod::Spec.new do |s| |
| 21 | 21 | TODO: Add long description of the pod here. |
| 22 | 22 | DESC |
| 23 | 23 | |
| 24 | - s.homepage = 'https://github.com/jyyjkt/CNLiveImagePickerController' | |
| 24 | + s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveImagePickerController' | |
| 25 | 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' |
| 26 | 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } |
| 27 | - s.author = { 'jyyjkt' => 'jyyjkt@qq.com' } | |
| 28 | - s.source = { :git => 'https://github.com/jyyjkt/CNLiveImagePickerController.git', :tag => s.version.to_s } | |
| 27 | + s.author = { 'lianxingguo' => 'jyyjkt@qq.com' } | |
| 28 | + s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveImagePickerController.git', :tag => s.version.to_s } | |
| 29 | 29 | # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' |
| 30 | 30 | |
| 31 | 31 | s.ios.deployment_target = '8.0' |
| 32 | 32 | |
| 33 | - s.source_files = 'CNLiveImagePickerController/Classes/**/*' | |
| 33 | + s.requires_arc = true | |
| 34 | + s.resources = "CNLiveImagePickerController/Classes/*.{png,bundle}" | |
| 35 | + s.source_files = "CNLiveImagePickerController/Classes/*.{h,m}" | |
| 36 | + s.frameworks = "Photos", "CoreServices" | |
| 34 | 37 | |
| 35 | 38 | # s.resource_bundles = { |
| 36 | 39 | # 'CNLiveImagePickerController' => ['CNLiveImagePickerController/Assets/*.png'] |
| ... | ... | @@ -38,5 +41,9 @@ TODO: Add long description of the pod here. |
| 38 | 41 | |
| 39 | 42 | # s.public_header_files = 'Pod/Classes/**/*.h' |
| 40 | 43 | # s.frameworks = 'UIKit', 'MapKit' |
| 41 | - # s.dependency 'AFNetworking', '~> 2.3' | |
| 44 | + s.dependency 'CNLiveBaseKit' | |
| 45 | +# s.dependency 'CNLiveUploadManager' | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 42 | 49 | end | ... | ... |
CNLiveImagePickerController/Classes/.gitkeep deleted
100644 → 0
CNLiveImagePickerController/Classes/CNEditVideoController.m
| ... | ... | @@ -120,58 +120,59 @@ |
| 120 | 120 | CGPoint point = [pan locationInView:self]; |
| 121 | 121 | |
| 122 | 122 | CGRect rct = self.validRect; |
| 123 | - | |
| 124 | - const CGFloat W = self.width; | |
| 125 | - CGFloat minX = 0; | |
| 126 | - CGFloat maxX = W; | |
| 127 | - | |
| 128 | - switch (pan.view.tag) { | |
| 129 | - case 0: { | |
| 130 | - //left视图响应 | |
| 131 | - maxX = rct.origin.x + rct.size.width - kItemWidth; | |
| 132 | - | |
| 133 | - point.x = MAX(minX, MIN(point.x, maxX)); | |
| 134 | - point.y = 0; | |
| 135 | - | |
| 136 | - rct.size.width -= (point.x - rct.origin.x); | |
| 137 | - rct.origin.x = point.x; | |
| 138 | - } | |
| 139 | - break; | |
| 140 | - | |
| 141 | - case 1: | |
| 142 | - { | |
| 143 | - //right视图响应 | |
| 144 | - minX = rct.origin.x + kItemWidth/2; | |
| 145 | - maxX = W - kItemWidth/2; | |
| 146 | - | |
| 147 | - point.x = MAX(minX, MIN(point.x, maxX)); | |
| 148 | - point.y = 0; | |
| 149 | - | |
| 150 | - rct.size.width = (point.x - rct.origin.x + kItemWidth/2); | |
| 151 | - } | |
| 152 | - break; | |
| 153 | - } | |
| 154 | - | |
| 155 | - switch (pan.state) { | |
| 156 | - case UIGestureRecognizerStateBegan: | |
| 157 | - case UIGestureRecognizerStateChanged: | |
| 158 | - if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectChanged)]) { | |
| 159 | - [self.delegate editViewValidRectChanged];//滑动响应实现 | |
| 160 | - } | |
| 161 | - break; | |
| 162 | - | |
| 163 | - case UIGestureRecognizerStateEnded: | |
| 164 | - case UIGestureRecognizerStateCancelled: | |
| 165 | - self.layer.borderColor = [UIColor clearColor].CGColor; | |
| 166 | - if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectEndChanged)]) { | |
| 167 | - [self.delegate editViewValidRectEndChanged];//滑动结束响应实现 | |
| 168 | - } | |
| 169 | - break; | |
| 170 | - | |
| 171 | - default: | |
| 172 | - break; | |
| 173 | - } | |
| 174 | - | |
| 123 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 124 | +// const CGFloat W = self.width; | |
| 125 | +// CGFloat minX = 0; | |
| 126 | +// CGFloat maxX = W; | |
| 127 | +// | |
| 128 | +// switch (pan.view.tag) { | |
| 129 | +// case 0: { | |
| 130 | +// //left视图响应 | |
| 131 | +// maxX = rct.origin.x + rct.size.width - kItemWidth; | |
| 132 | +// | |
| 133 | +// point.x = MAX(minX, MIN(point.x, maxX)); | |
| 134 | +// point.y = 0; | |
| 135 | +// | |
| 136 | +// rct.size.width -= (point.x - rct.origin.x); | |
| 137 | +// rct.origin.x = point.x; | |
| 138 | +// } | |
| 139 | +// break; | |
| 140 | +// | |
| 141 | +// case 1: | |
| 142 | +// { | |
| 143 | +// //right视图响应 | |
| 144 | +// minX = rct.origin.x + kItemWidth/2; | |
| 145 | +// maxX = W - kItemWidth/2; | |
| 146 | +// | |
| 147 | +// point.x = MAX(minX, MIN(point.x, maxX)); | |
| 148 | +// point.y = 0; | |
| 149 | +// | |
| 150 | +// rct.size.width = (point.x - rct.origin.x + kItemWidth/2); | |
| 151 | +// } | |
| 152 | +// break; | |
| 153 | +// } | |
| 154 | +// | |
| 155 | +// switch (pan.state) { | |
| 156 | +// case UIGestureRecognizerStateBegan: | |
| 157 | +// case UIGestureRecognizerStateChanged: | |
| 158 | +// if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectChanged)]) { | |
| 159 | +// [self.delegate editViewValidRectChanged];//滑动响应实现 | |
| 160 | +// } | |
| 161 | +// break; | |
| 162 | +// | |
| 163 | +// case UIGestureRecognizerStateEnded: | |
| 164 | +// case UIGestureRecognizerStateCancelled: | |
| 165 | +// self.layer.borderColor = [UIColor clearColor].CGColor; | |
| 166 | +// if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectEndChanged)]) { | |
| 167 | +// [self.delegate editViewValidRectEndChanged];//滑动结束响应实现 | |
| 168 | +// } | |
| 169 | +// break; | |
| 170 | +// | |
| 171 | +// default: | |
| 172 | +// break; | |
| 173 | +// } | |
| 174 | +// | |
| 175 | + ////////////////////////////// | |
| 175 | 176 | |
| 176 | 177 | self.validRect = rct; |
| 177 | 178 | } |
| ... | ... | @@ -298,29 +299,30 @@ |
| 298 | 299 | - (void)viewDidLayoutSubviews |
| 299 | 300 | { |
| 300 | 301 | [super viewDidLayoutSubviews]; |
| 301 | - | |
| 302 | - UIEdgeInsets inset = UIEdgeInsetsZero; | |
| 303 | - if (@available(iOS 11, *)) { | |
| 304 | - inset = self.view.safeAreaInsets; | |
| 305 | - } | |
| 306 | - | |
| 307 | - self.playerLayer.frame = CGRectMake(15, inset.top>0?inset.top:30, KScreenWidth-30, KScreenHeight-160-inset.bottom); | |
| 308 | - | |
| 309 | - self.editView.frame = CGRectMake((KScreenWidth-kItemWidth*10)/2, KScreenHeight-100-inset.bottom, kItemWidth*10, kItemHeight); | |
| 310 | - self.editView.validRect = self.editView.bounds; | |
| 311 | - self.collectionView.frame = CGRectMake(inset.left, KScreenHeight-100-inset.bottom, KScreenWidth-inset.left-inset.right, kItemHeight); | |
| 312 | - | |
| 313 | - CGFloat leftOffset = ((KScreenWidth-kItemWidth*10)/2-inset.left); | |
| 314 | - CGFloat rightOffset = ((KScreenWidth-kItemWidth*10)/2-inset.right); | |
| 315 | - [self.collectionView setContentInset:UIEdgeInsetsMake(0, leftOffset, 0, rightOffset)]; | |
| 316 | - [self.collectionView setContentOffset:CGPointMake(_offsetX-leftOffset, 0)]; | |
| 317 | - | |
| 318 | - CGFloat bottomViewH = 44; | |
| 319 | - CGFloat bottomBtnH = 30; | |
| 320 | - _bottomView.frame = CGRectMake(0, KScreenHeight-bottomViewH-inset.bottom, KScreenWidth, kItemHeight); | |
| 321 | - _cancelBtn.frame = CGRectMake(10+inset.left, 7, 60, bottomBtnH); | |
| 322 | - _doneBtn.frame = CGRectMake(KScreenWidth-70-inset.right, 7, 60, bottomBtnH); | |
| 323 | - | |
| 302 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 303 | +// UIEdgeInsets inset = UIEdgeInsetsZero; | |
| 304 | +// if (@available(iOS 11, *)) { | |
| 305 | +// inset = self.view.safeAreaInsets; | |
| 306 | +// } | |
| 307 | +// | |
| 308 | +// self.playerLayer.frame = CGRectMake(15, inset.top>0?inset.top:30, KScreenWidth-30, KScreenHeight-160-inset.bottom); | |
| 309 | +// | |
| 310 | +// self.editView.frame = CGRectMake((KScreenWidth-kItemWidth*10)/2, KScreenHeight-100-inset.bottom, kItemWidth*10, kItemHeight); | |
| 311 | +// self.editView.validRect = self.editView.bounds; | |
| 312 | +// self.collectionView.frame = CGRectMake(inset.left, KScreenHeight-100-inset.bottom, KScreenWidth-inset.left-inset.right, kItemHeight); | |
| 313 | +// | |
| 314 | +// CGFloat leftOffset = ((KScreenWidth-kItemWidth*10)/2-inset.left); | |
| 315 | +// CGFloat rightOffset = ((KScreenWidth-kItemWidth*10)/2-inset.right); | |
| 316 | +// [self.collectionView setContentInset:UIEdgeInsetsMake(0, leftOffset, 0, rightOffset)]; | |
| 317 | +// [self.collectionView setContentOffset:CGPointMake(_offsetX-leftOffset, 0)]; | |
| 318 | +// | |
| 319 | +// CGFloat bottomViewH = 44; | |
| 320 | +// CGFloat bottomBtnH = 30; | |
| 321 | +// _bottomView.frame = CGRectMake(0, KScreenHeight-bottomViewH-inset.bottom, KScreenWidth, kItemHeight); | |
| 322 | +// _cancelBtn.frame = CGRectMake(10+inset.left, 7, 60, bottomBtnH); | |
| 323 | +// _doneBtn.frame = CGRectMake(KScreenWidth-70-inset.right, 7, 60, bottomBtnH); | |
| 324 | +// | |
| 325 | + /////////////////////////////////////// | |
| 324 | 326 | [self.playerLayer setBackgroundColor:[UIColor clearColor].CGColor]; |
| 325 | 327 | } |
| 326 | 328 | |
| ... | ... | @@ -377,7 +379,9 @@ |
| 377 | 379 | [self.view addSubview:self.editView]; |
| 378 | 380 | |
| 379 | 381 | _indicatorLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 2, kItemHeight)]; |
| 380 | - _indicatorLine.backgroundColor = [RGBOF(0x0BBE06) colorWithAlphaComponent:.7]; | |
| 382 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 383 | +// _indicatorLine.backgroundColor = [RGBOF(0x0BBE06) colorWithAlphaComponent:.7]; | |
| 384 | + ///////////////// | |
| 381 | 385 | } |
| 382 | 386 | |
| 383 | 387 | - (void)creatBottomView |
| ... | ... | @@ -393,12 +397,14 @@ |
| 393 | 397 | [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; |
| 394 | 398 | [_cancelBtn addTarget:self action:@selector(cancelBtn_click) forControlEvents:UIControlEventTouchUpInside]; |
| 395 | 399 | [_bottomView addSubview:_cancelBtn]; |
| 396 | - | |
| 397 | - _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 398 | - [_doneBtn setTitle:@"完成" forState:UIControlStateNormal]; | |
| 399 | - [_doneBtn setBackgroundColor:[UIColor clearColor]]; | |
| 400 | - [_doneBtn setTitleColor:RGBOF(0x0BBE06) forState:UIControlStateNormal]; | |
| 401 | - _doneBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 400 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 401 | +// _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 402 | +// [_doneBtn setTitle:@"完成" forState:UIControlStateNormal]; | |
| 403 | +// [_doneBtn setBackgroundColor:[UIColor clearColor]]; | |
| 404 | +// | |
| 405 | +// [_doneBtn setTitleColor:RGBOF(0x0BBE06) forState:UIControlStateNormal]; | |
| 406 | +// _doneBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | |
| 407 | + //////////////////////// | |
| 402 | 408 | _doneBtn.layer.masksToBounds = YES; |
| 403 | 409 | _doneBtn.layer.cornerRadius = 3.0f; |
| 404 | 410 | [_doneBtn addTarget:self action:@selector(btnDone_click) forControlEvents:UIControlEventTouchUpInside]; |
| ... | ... | @@ -502,12 +508,23 @@ |
| 502 | 508 | |
| 503 | 509 | TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController; |
| 504 | 510 | [_tzImagePickerVc showProgressHUD]; |
| 511 | + _doneBtn.enabled = NO; | |
| 512 | + _cancelBtn.enabled = NO; | |
| 505 | 513 | __weak typeof(self) weakSelf = self; |
| 506 | 514 | |
| 515 | + if (!_avAsset) { | |
| 516 | + [_tzImagePickerVc hideProgressHUD]; | |
| 517 | + [_tzImagePickerVc showAlertWithTitle:@"编辑视频失败"]; | |
| 518 | + _doneBtn.enabled = YES; | |
| 519 | + _cancelBtn.enabled = YES; | |
| 520 | + return; | |
| 521 | + } | |
| 507 | 522 | [self exportEditVideoForAsset:_avAsset range:[self getTimeRange] complete:^(BOOL isSuc, id asset) { |
| 508 | 523 | [_tzImagePickerVc hideProgressHUD]; |
| 524 | + | |
| 509 | 525 | if (isSuc) { |
| 510 | 526 | [self stopPlay]; |
| 527 | + [_tzImagePickerVc showProgressHUD]; | |
| 511 | 528 | TZAssetModel *editModel = [TZAssetModel modelWithAsset:asset type:TZAssetModelMediaTypeVideo]; |
| 512 | 529 | |
| 513 | 530 | // 如果没有选中过照片 点击确定时选中当前预览的照片 |
| ... | ... | @@ -519,8 +536,17 @@ |
| 519 | 536 | weakSelf.doneButtonEditClickBlock(_tzImagePickerVc.isSelectOriginalPhoto); |
| 520 | 537 | } |
| 521 | 538 | [_tzImagePickerVc hideProgressHUD]; |
| 539 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 540 | + self->_doneBtn.enabled = YES; | |
| 541 | + self->_cancelBtn.enabled = YES; | |
| 542 | + }); | |
| 543 | + | |
| 522 | 544 | }else{ |
| 523 | 545 | [_tzImagePickerVc showAlertWithTitle:@"编辑失败"]; |
| 546 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 547 | + self->_doneBtn.enabled = YES; | |
| 548 | + self->_cancelBtn.enabled = YES; | |
| 549 | + }); | |
| 524 | 550 | } |
| 525 | 551 | |
| 526 | 552 | }]; | ... | ... |
CNLiveImagePickerController/Classes/CNImagePickerController.m
| ... | ... | @@ -44,254 +44,256 @@ |
| 44 | 44 | // imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor]; |
| 45 | 45 | // imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor]; |
| 46 | 46 | // imagePickerVc.navigationBar.translucent = NO; |
| 47 | - self.iconThemeColor = RGBOF(0x00BBE06);// 主体颜色 | |
| 48 | - self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层 | |
| 49 | - self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层 | |
| 50 | - self.photoDefImage = [UIImage imageNamed:@"photo_cell_normal"]; | |
| 51 | - self.photoSelImage = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(22, 22) cornerRadius:11]; | |
| 52 | - self.photoOriginDefImage = [UIImage imageNamed:@"photo_original_nor"]; | |
| 53 | - | |
| 54 | - // 3. Set allow picking video & photo & originalPhoto or not | |
| 55 | - // 3. 设置是否可以选择视频/图片/原图/gif(未开放) | |
| 56 | - self.allowPickingVideo = YES;// 显示视频 | |
| 57 | - self.allowPickingImage = YES;// 显示图片 | |
| 58 | - self.allowPickingOriginalPhoto = YES; //显示原图 | |
| 59 | - self.allowPickingGif = NO;// 显示GIF | |
| 60 | - self.allowPickingMultipleVideo = YES; // 是否可以多选视频 | |
| 61 | - | |
| 62 | - // 4. 照片排列按修改时间升序 | |
| 63 | - self.sortAscendingByModificationDate = YES; | |
| 64 | - | |
| 65 | - // imagePickerVc.minImagesCount = 3; | |
| 66 | - // imagePickerVc.alwaysEnableDoneBtn = YES; | |
| 67 | - | |
| 68 | - // imagePickerVc.minPhotoWidthSelectable = 3000; | |
| 69 | - // imagePickerVc.minPhotoHeightSelectable = 2000; | |
| 70 | - | |
| 71 | - /// 5. Single selection mode, valid when maxImagesCount = 1 | |
| 72 | - /// 5. 单选模式,maxImagesCount为1时才生效 | |
| 73 | - self.showSelectBtn = NO; | |
| 74 | - self.allowCrop = NO; | |
| 75 | - self.needCircleCrop = NO; | |
| 76 | - // 设置横屏下的裁剪尺寸 | |
| 77 | - // imagePickerVc.cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, left, widthHeight, widthHeight); | |
| 78 | - /* | |
| 79 | - [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) { | |
| 80 | - cropView.layer.borderColor = [UIColor redColor].CGColor; | |
| 81 | - cropView.layer.borderWidth = 2.0; | |
| 82 | - }];*/ | |
| 83 | - | |
| 84 | - //imagePickerVc.allowPreview = NO; | |
| 85 | - // 自定义导航栏上的返回按钮 | |
| 86 | - /* | |
| 87 | - [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){ | |
| 88 | - [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal]; | |
| 89 | - [leftButton setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 20)]; | |
| 90 | - }]; | |
| 91 | - imagePickerVc.delegate = self; | |
| 92 | - */ | |
| 93 | - | |
| 94 | - self.statusBarStyle = UIStatusBarStyleDefault;//状态栏黑色 | |
| 95 | - | |
| 96 | - self.showSelectedIndex = YES; // 设置是否显示图片序号 | |
| 97 | - | |
| 98 | - self.naviBgColor = RGBOF(0xFFFFFF);//导航栏颜色 | |
| 99 | - self.naviTitleColor = RGBOF(0x282828);//相册title | |
| 100 | - self.naviTitleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:18];//title文字大小 | |
| 101 | - [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标 | |
| 102 | - [leftButton setImage:[UIImage imageNamed:@"photo_back"] forState:UIControlStateNormal];//返回按钮图片 | |
| 103 | - [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小 | |
| 104 | - [leftButton setTitleColor:RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色 | |
| 105 | - leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小 | |
| 106 | - leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘 | |
| 107 | - }]; | |
| 108 | - self.barItemTextColor = RGBOF(0x282828);//设置barItem文字颜色 | |
| 109 | - self.barItemTextFont = [UIFont systemFontOfSize:15]; | |
| 110 | - | |
| 111 | - // 设置首选语言 / Set preferred language | |
| 112 | - // imagePickerVc.preferredLanguage = @"zh-Hans"; | |
| 113 | - | |
| 114 | - // 设置languageBundle以使用其它语言 / Set languageBundle to use other language | |
| 115 | - // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]]; | |
| 116 | - | |
| 117 | - /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等 | |
| 118 | - //相册 | |
| 119 | - [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | |
| 120 | - | |
| 121 | - //底部栏 | |
| 122 | - [bottomToolBar setBackgroundColor:RGBOF(0xFFFFFF)]; | |
| 123 | - | |
| 124 | - //预览 | |
| 125 | - previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 126 | - [previewButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用 | |
| 127 | - [previewButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];//默认 | |
| 128 | - | |
| 129 | - //原图按钮 | |
| 130 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | |
| 131 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | |
| 132 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | |
| 133 | - originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 134 | - [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | |
| 135 | - [originalPhotoButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal]; | |
| 136 | - | |
| 137 | - //原图文字提示 | |
| 138 | - originalPhotoLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:16]; | |
| 139 | - originalPhotoLabel.textColor = RGBOF(0xB3B3B3); | |
| 140 | - originalPhotoLabel.hidden = YES; | |
| 141 | - | |
| 142 | - //选中提示 | |
| 143 | - numberImageView = [UIImageView new]; | |
| 144 | - numberLabel = [UILabel new]; | |
| 145 | - | |
| 146 | - //完成按钮 | |
| 147 | - doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 148 | - [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 149 | - [doneButton setTitleColor:RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled]; | |
| 150 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 151 | - | |
| 152 | - //颜色绘制成图片 | |
| 153 | - UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 154 | - [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled]; | |
| 155 | - UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 156 | - [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 157 | - doneButton.layer.masksToBounds = YES; | |
| 158 | - doneButton.layer.cornerRadius = 5; | |
| 159 | - | |
| 160 | - //分割线 | |
| 161 | - [divideLine setBackgroundColor:RGBOF(0xDEDEDE)]; | |
| 162 | - | |
| 163 | - }]; | |
| 164 | - | |
| 165 | - //图片预览 | |
| 166 | - [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | |
| 167 | - | |
| 168 | - //返回按钮 | |
| 169 | - [backButton setImage:[UIImage imageNamed:@"photo_original_back"] forState:UIControlStateNormal]; | |
| 170 | - //选择按钮 | |
| 171 | - [selectButton setImage:[UIImage imageNamed:@"photo_original_nor"] forState:UIControlStateNormal]; | |
| 172 | - [selectButton setImage:[UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(28, 28) cornerRadius:14] forState:UIControlStateSelected]; | |
| 173 | - [selectButton setTitle:@"" forState:UIControlStateDisabled]; | |
| 174 | - | |
| 175 | - //原图按钮 | |
| 176 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | |
| 177 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | |
| 178 | - [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | |
| 179 | - originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 180 | - [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | |
| 181 | - [originalPhotoButton setTitleColor:RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal]; | |
| 182 | - //原图内容隐藏 | |
| 183 | - originalPhotoLabel.hidden = YES; | |
| 184 | - | |
| 185 | - //完成按钮 | |
| 186 | - doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 187 | - [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 188 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 189 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 190 | - | |
| 191 | - //颜色绘制成图片 | |
| 192 | - UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 193 | - [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 194 | - UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 195 | - [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 196 | - doneButton.layer.masksToBounds = YES; | |
| 197 | - doneButton.layer.cornerRadius = 5; | |
| 198 | - }]; | |
| 199 | - | |
| 200 | - //视频预览 | |
| 201 | - [self setVideoPreviewPageUIConfigBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { | |
| 202 | - | |
| 203 | - //完成按钮 | |
| 204 | - doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 205 | - [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 206 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 207 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 208 | - | |
| 209 | - //颜色绘制成图片 | |
| 210 | - UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 211 | - [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 212 | - UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 213 | - [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 214 | - doneButton.layer.masksToBounds = YES; | |
| 215 | - doneButton.layer.cornerRadius = 5; | |
| 216 | - | |
| 217 | - }]; | |
| 218 | - | |
| 219 | - //gif预览 | |
| 220 | - [self setGifPreviewPageUIConfigBlock:^(UIView *toolBar, UIButton *doneButton) { | |
| 221 | - | |
| 222 | - //完成按钮 | |
| 223 | - doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 224 | - [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 225 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 226 | - [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 227 | - | |
| 228 | - //颜色绘制成图片 | |
| 229 | - UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 230 | - [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 231 | - UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 232 | - [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 233 | - doneButton.layer.masksToBounds = YES; | |
| 234 | - doneButton.layer.cornerRadius = 5; | |
| 235 | - | |
| 236 | - }]; | |
| 237 | - //相册cell | |
| 238 | - [self setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { | |
| 239 | - | |
| 240 | - | |
| 241 | - }]; | |
| 242 | - //相簿 | |
| 243 | - [self setAlbumCellDidSetModelBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) { | |
| 244 | - [posterImageView setBackgroundColor:[UIColor blueColor]]; | |
| 245 | - [posterImageView setBackgroundColor:[UIColor blueColor]]; | |
| 246 | - | |
| 247 | - }]; | |
| 248 | - | |
| 249 | - | |
| 250 | - /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等 | |
| 251 | - //相册 | |
| 252 | - [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | |
| 253 | - | |
| 254 | - CGRect frame = bottomToolBar.frame; | |
| 255 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 256 | - | |
| 257 | - CGRect originalPhotoLabelFrame = originalPhotoLabel.frame; | |
| 258 | - CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2; | |
| 259 | - CGFloat originalY = originalPhotoLabelFrame.origin.y; | |
| 260 | - originalPhotoButton.frame = CGRectMake(originalX, originalY, originalPhotoLabelFrame.size.width, originalPhotoLabelFrame.size.height); | |
| 261 | - | |
| 262 | - | |
| 263 | - }]; | |
| 264 | - //图片预览 | |
| 265 | - [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | |
| 266 | - | |
| 267 | - CGRect frame = toolBar.frame; | |
| 268 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 269 | - | |
| 270 | - }]; | |
| 271 | - //视频预览 | |
| 272 | - [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { | |
| 273 | - | |
| 274 | - CGRect frame = toolBar.frame; | |
| 275 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 276 | - | |
| 277 | - }]; | |
| 278 | - //gif预览 | |
| 279 | - [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) { | |
| 280 | - | |
| 281 | - CGRect frame = toolBar.frame; | |
| 282 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 283 | - | |
| 284 | - }]; | |
| 285 | - //相册cell | |
| 286 | - [self setAssetCellDidLayoutSubviewsBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { | |
| 287 | - }]; | |
| 288 | - //相簿 | |
| 289 | - [self setAlbumCellDidLayoutSubviewsBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) { | |
| 290 | - | |
| 291 | - }]; | |
| 292 | - | |
| 293 | - //设置图片个数 | |
| 294 | - self.photoNumberIconImage = [UIImage new]; | |
| 47 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 48 | +// self.iconThemeColor = RGBOF(0x00BBE06);// 主体颜色 | |
| 49 | +// self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层 | |
| 50 | +// self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层 | |
| 51 | +// self.photoDefImage = [UIImage imageNamed:@"photo_cell_normal"]; | |
| 52 | +// self.photoSelImage = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(22, 22) cornerRadius:11]; | |
| 53 | +// self.photoOriginDefImage = [UIImage imageNamed:@"photo_original_nor"]; | |
| 54 | +// | |
| 55 | +// // 3. Set allow picking video & photo & originalPhoto or not | |
| 56 | +// // 3. 设置是否可以选择视频/图片/原图/gif(未开放) | |
| 57 | +// self.allowPickingVideo = YES;// 显示视频 | |
| 58 | +// self.allowPickingImage = YES;// 显示图片 | |
| 59 | +// self.allowPickingOriginalPhoto = YES; //显示原图 | |
| 60 | +// self.allowPickingGif = NO;// 显示GIF | |
| 61 | +// self.allowPickingMultipleVideo = YES; // 是否可以多选视频 | |
| 62 | +// | |
| 63 | +// // 4. 照片排列按修改时间升序 | |
| 64 | +// self.sortAscendingByModificationDate = YES; | |
| 65 | +// | |
| 66 | +// // imagePickerVc.minImagesCount = 3; | |
| 67 | +// // imagePickerVc.alwaysEnableDoneBtn = YES; | |
| 68 | +// | |
| 69 | +// // imagePickerVc.minPhotoWidthSelectable = 3000; | |
| 70 | +// // imagePickerVc.minPhotoHeightSelectable = 2000; | |
| 71 | +// | |
| 72 | +// /// 5. Single selection mode, valid when maxImagesCount = 1 | |
| 73 | +// /// 5. 单选模式,maxImagesCount为1时才生效 | |
| 74 | +// self.showSelectBtn = NO; | |
| 75 | +// self.allowCrop = NO; | |
| 76 | +// self.needCircleCrop = NO; | |
| 77 | +// // 设置横屏下的裁剪尺寸 | |
| 78 | +// // imagePickerVc.cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, left, widthHeight, widthHeight); | |
| 79 | +// /* | |
| 80 | +// [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) { | |
| 81 | +// cropView.layer.borderColor = [UIColor redColor].CGColor; | |
| 82 | +// cropView.layer.borderWidth = 2.0; | |
| 83 | +// }];*/ | |
| 84 | +// | |
| 85 | +// //imagePickerVc.allowPreview = NO; | |
| 86 | +// // 自定义导航栏上的返回按钮 | |
| 87 | +// /* | |
| 88 | +// [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){ | |
| 89 | +// [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal]; | |
| 90 | +// [leftButton setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 20)]; | |
| 91 | +// }]; | |
| 92 | +// imagePickerVc.delegate = self; | |
| 93 | +// */ | |
| 94 | +// | |
| 95 | +// self.statusBarStyle = UIStatusBarStyleDefault;//状态栏黑色 | |
| 96 | +// | |
| 97 | +// self.showSelectedIndex = YES; // 设置是否显示图片序号 | |
| 98 | +// | |
| 99 | +// self.naviBgColor = RGBOF(0xFFFFFF);//导航栏颜色 | |
| 100 | +// self.naviTitleColor = RGBOF(0x282828);//相册title | |
| 101 | +// self.naviTitleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:18];//title文字大小 | |
| 102 | +// [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标 | |
| 103 | +// [leftButton setImage:[UIImage imageNamed:@"photo_back"] forState:UIControlStateNormal];//返回按钮图片 | |
| 104 | +// [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小 | |
| 105 | +// [leftButton setTitleColor:RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色 | |
| 106 | +// leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小 | |
| 107 | +// leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘 | |
| 108 | +// }]; | |
| 109 | +// self.barItemTextColor = RGBOF(0x282828);//设置barItem文字颜色 | |
| 110 | +// self.barItemTextFont = [UIFont systemFontOfSize:15]; | |
| 111 | +// | |
| 112 | +// // 设置首选语言 / Set preferred language | |
| 113 | +// // imagePickerVc.preferredLanguage = @"zh-Hans"; | |
| 114 | +// | |
| 115 | +// // 设置languageBundle以使用其它语言 / Set languageBundle to use other language | |
| 116 | +// // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]]; | |
| 117 | +// | |
| 118 | +// /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等 | |
| 119 | +// //相册 | |
| 120 | +// [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | |
| 121 | +// | |
| 122 | +// //底部栏 | |
| 123 | +// [bottomToolBar setBackgroundColor:RGBOF(0xFFFFFF)]; | |
| 124 | +// | |
| 125 | +// //预览 | |
| 126 | +// previewButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 127 | +// [previewButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用 | |
| 128 | +// [previewButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];//默认 | |
| 129 | +// | |
| 130 | +// //原图按钮 | |
| 131 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | |
| 132 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | |
| 133 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | |
| 134 | +// originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 135 | +// [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | |
| 136 | +// [originalPhotoButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal]; | |
| 137 | +// | |
| 138 | +// //原图文字提示 | |
| 139 | +// originalPhotoLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:16]; | |
| 140 | +// originalPhotoLabel.textColor = RGBOF(0xB3B3B3); | |
| 141 | +// originalPhotoLabel.hidden = YES; | |
| 142 | +// | |
| 143 | +// //选中提示 | |
| 144 | +// numberImageView = [UIImageView new]; | |
| 145 | +// numberLabel = [UILabel new]; | |
| 146 | +// | |
| 147 | +// //完成按钮 | |
| 148 | +// doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 149 | +// [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 150 | +// [doneButton setTitleColor:RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled]; | |
| 151 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 152 | +// | |
| 153 | +// //颜色绘制成图片 | |
| 154 | +// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 155 | +// [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled]; | |
| 156 | +// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 157 | +// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 158 | +// doneButton.layer.masksToBounds = YES; | |
| 159 | +// doneButton.layer.cornerRadius = 5; | |
| 160 | +// | |
| 161 | +// //分割线 | |
| 162 | +// [divideLine setBackgroundColor:RGBOF(0xDEDEDE)]; | |
| 163 | +// | |
| 164 | +// }]; | |
| 165 | + | |
| 166 | +// //图片预览 | |
| 167 | +// [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | |
| 168 | +// | |
| 169 | +// //返回按钮 | |
| 170 | +// [backButton setImage:[UIImage imageNamed:@"photo_original_back"] forState:UIControlStateNormal]; | |
| 171 | +// //选择按钮 | |
| 172 | +// [selectButton setImage:[UIImage imageNamed:@"photo_original_nor"] forState:UIControlStateNormal]; | |
| 173 | +// [selectButton setImage:[UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(28, 28) cornerRadius:14] forState:UIControlStateSelected]; | |
| 174 | +// [selectButton setTitle:@"" forState:UIControlStateDisabled]; | |
| 175 | +// | |
| 176 | +// //原图按钮 | |
| 177 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用 | |
| 178 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认 | |
| 179 | +// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中 | |
| 180 | +// originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 181 | +// [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled]; | |
| 182 | +// [originalPhotoButton setTitleColor:RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal]; | |
| 183 | +// //原图内容隐藏 | |
| 184 | +// originalPhotoLabel.hidden = YES; | |
| 185 | +// | |
| 186 | +// //完成按钮 | |
| 187 | +// doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 188 | +// [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 189 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 190 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 191 | +// | |
| 192 | +// //颜色绘制成图片 | |
| 193 | +// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 194 | +// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 195 | +// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 196 | +// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 197 | +// doneButton.layer.masksToBounds = YES; | |
| 198 | +// doneButton.layer.cornerRadius = 5; | |
| 199 | +// }]; | |
| 200 | +// | |
| 201 | +// //视频预览 | |
| 202 | +// [self setVideoPreviewPageUIConfigBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { | |
| 203 | +// | |
| 204 | +// //完成按钮 | |
| 205 | +// doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 206 | +// [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 207 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 208 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 209 | +// | |
| 210 | +// //颜色绘制成图片 | |
| 211 | +// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 212 | +// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 213 | +// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 214 | +// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 215 | +// doneButton.layer.masksToBounds = YES; | |
| 216 | +// doneButton.layer.cornerRadius = 5; | |
| 217 | +// | |
| 218 | +// }]; | |
| 219 | +// | |
| 220 | +// //gif预览 | |
| 221 | +// [self setGifPreviewPageUIConfigBlock:^(UIView *toolBar, UIButton *doneButton) { | |
| 222 | +// | |
| 223 | +// //完成按钮 | |
| 224 | +// doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; | |
| 225 | +// [doneButton setTitle:@"完成" forState:UIControlStateDisabled]; | |
| 226 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 227 | +// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 228 | +// | |
| 229 | +// //颜色绘制成图片 | |
| 230 | +// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 231 | +// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 232 | +// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 233 | +// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 234 | +// doneButton.layer.masksToBounds = YES; | |
| 235 | +// doneButton.layer.cornerRadius = 5; | |
| 236 | +// | |
| 237 | +// }]; | |
| 238 | +// //相册cell | |
| 239 | +// [self setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { | |
| 240 | +// | |
| 241 | +// | |
| 242 | +// }]; | |
| 243 | +// //相簿 | |
| 244 | +// [self setAlbumCellDidSetModelBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) { | |
| 245 | +// [posterImageView setBackgroundColor:[UIColor blueColor]]; | |
| 246 | +// [posterImageView setBackgroundColor:[UIColor blueColor]]; | |
| 247 | +// | |
| 248 | +// }]; | |
| 249 | +// | |
| 250 | +// | |
| 251 | +// /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等 | |
| 252 | +// //相册 | |
| 253 | +// [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { | |
| 254 | +// | |
| 255 | +// CGRect frame = bottomToolBar.frame; | |
| 256 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 257 | +// | |
| 258 | +// CGRect originalPhotoLabelFrame = originalPhotoLabel.frame; | |
| 259 | +// CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2; | |
| 260 | +// CGFloat originalY = originalPhotoLabelFrame.origin.y; | |
| 261 | +// originalPhotoButton.frame = CGRectMake(originalX, originalY, originalPhotoLabelFrame.size.width, originalPhotoLabelFrame.size.height); | |
| 262 | +// | |
| 263 | +// | |
| 264 | +// }]; | |
| 265 | +// //图片预览 | |
| 266 | +// [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { | |
| 267 | +// | |
| 268 | +// CGRect frame = toolBar.frame; | |
| 269 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 270 | +// | |
| 271 | +// }]; | |
| 272 | +// //视频预览 | |
| 273 | +// [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { | |
| 274 | +// | |
| 275 | +// CGRect frame = toolBar.frame; | |
| 276 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 277 | +// | |
| 278 | +// }]; | |
| 279 | +// //gif预览 | |
| 280 | +// [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) { | |
| 281 | +// | |
| 282 | +// CGRect frame = toolBar.frame; | |
| 283 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 284 | +// | |
| 285 | +// }]; | |
| 286 | +// //相册cell | |
| 287 | +// [self setAssetCellDidLayoutSubviewsBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { | |
| 288 | +// }]; | |
| 289 | +// //相簿 | |
| 290 | +// [self setAlbumCellDidLayoutSubviewsBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) { | |
| 291 | +// | |
| 292 | +// }]; | |
| 293 | +// | |
| 294 | +// //设置图片个数 | |
| 295 | +// self.photoNumberIconImage = [UIImage new]; | |
| 296 | + //////////////////////////////////////// | |
| 295 | 297 | |
| 296 | 298 | } |
| 297 | 299 | ... | ... |
CNLiveImagePickerController/Classes/CNImagePickerManager.m
| ... | ... | @@ -23,27 +23,29 @@ |
| 23 | 23 | [imagePickerVc configTZImagePicker];//基本配置 |
| 24 | 24 | //特殊配置 |
| 25 | 25 | switch (enterType) { |
| 26 | - case CNImagePickerEnterTypeFriendsCircle: | |
| 27 | - imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | |
| 28 | - imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度 | |
| 29 | - // 3. 设置是否可以混选选择视频/图片/原图 | |
| 30 | - imagePickerVc.allowPickingMultipleVideo = NO; | |
| 31 | - break; | |
| 32 | - case CNImagePickerEnterTypeComment: | |
| 33 | -#pragma mark - TODO:根据不同设置 | |
| 34 | - break; | |
| 35 | - case CNImagePickerEnterTypeSweepCode: | |
| 36 | - | |
| 37 | - break; | |
| 38 | - case CNImagePickerEnterTypeChat: | |
| 39 | - | |
| 40 | - break; | |
| 41 | - case CNImagePickerEnterTypeWitness: | |
| 42 | - imagePickerVc.allowPickingImage = NO;// 显示图片 | |
| 43 | - imagePickerVc.allowPickingMultipleVideo = NO; | |
| 44 | - imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | |
| 45 | - imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度 | |
| 46 | - break; | |
| 26 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 27 | +// case CNImagePickerEnterTypeFriendsCircle: | |
| 28 | +// imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | |
| 29 | +// imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度 | |
| 30 | +// // 3. 设置是否可以混选选择视频/图片/原图 | |
| 31 | +// imagePickerVc.allowPickingMultipleVideo = NO; | |
| 32 | +// break; | |
| 33 | +// case CNImagePickerEnterTypeComment: | |
| 34 | +//#pragma mark - TODO:根据不同设置 | |
| 35 | +// break; | |
| 36 | +// case CNImagePickerEnterTypeSweepCode: | |
| 37 | +// | |
| 38 | +// break; | |
| 39 | +// case CNImagePickerEnterTypeChat: | |
| 40 | +// | |
| 41 | +// break; | |
| 42 | +// case CNImagePickerEnterTypeWitness: | |
| 43 | +// imagePickerVc.allowPickingImage = NO;// 显示图片 | |
| 44 | +// imagePickerVc.allowPickingMultipleVideo = NO; | |
| 45 | +// imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | |
| 46 | +// imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度 | |
| 47 | +// break; | |
| 48 | + ////////////////////////////// | |
| 47 | 49 | case CNImagePickedEnterTypeField: |
| 48 | 50 | imagePickerVc.allowPickingImage = YES;// 显示图片 |
| 49 | 51 | imagePickerVc.allowPickingMultipleVideo = NO; |
| ... | ... | @@ -53,17 +55,19 @@ |
| 53 | 55 | default://其他 |
| 54 | 56 | break; |
| 55 | 57 | } |
| 56 | - | |
| 58 | + imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 57 | 59 | imagePickerVc.isSelectOriginalPhoto = isSelectOriginalPhoto;//是否选择原图 |
| 58 | 60 | // 1.设置目前已经选中的图片数组 |
| 59 | 61 | imagePickerVc.selectedAssets = selectedAssets; // 目前已经选中的图片数组 |
| 60 | 62 | /// 5. Single selection mode, valid when maxImagesCount = 1 |
| 61 | 63 | /// 5. 单选模式,maxImagesCount为1时才生效 |
| 62 | 64 | // 设置竖屏下的裁剪尺寸 |
| 63 | - NSInteger left = 30; | |
| 64 | - NSInteger widthHeight = vc.view.width - 2 * left; | |
| 65 | - NSInteger top = (vc.view.height - widthHeight) / 2; | |
| 66 | - imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight); | |
| 65 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 66 | +// NSInteger left = 30; | |
| 67 | +// NSInteger widthHeight = vc.view.width - 2 * left; | |
| 68 | +// NSInteger top = (vc.view.height - widthHeight) / 2; | |
| 69 | +// imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight); | |
| 70 | + //////////////////////// | |
| 67 | 71 | // 你可以通过block或者代理,来得到用户选择的照片. |
| 68 | 72 | [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { |
| 69 | 73 | // 回调参数 |
| ... | ... | @@ -93,6 +97,7 @@ |
| 93 | 97 | |
| 94 | 98 | CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithSelectedAssets:selectedAssets selectedPhotos:selectedPhotos index:index]; |
| 95 | 99 | [imagePickerVc configTZImagePicker];//基本配置 |
| 100 | + imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 96 | 101 | //特殊配置 |
| 97 | 102 | switch (enterType) { |
| 98 | 103 | case CNImagePickerEnterTypeFriendsCircle: |
| ... | ... | @@ -142,6 +147,7 @@ |
| 142 | 147 | TZAssetModel *model = [TZAssetModel modelWithAsset:selectedAsset type:TZAssetModelMediaTypeVideo timeLength:@""]; |
| 143 | 148 | videoVC.isOther = YES;//(LXG)相册外进入 |
| 144 | 149 | videoVC.model = model; |
| 150 | + videoVC.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 145 | 151 | [vc presentViewController:videoVC animated:YES completion:nil]; |
| 146 | 152 | |
| 147 | 153 | } | ... | ... |
CNLiveImagePickerController/Classes/TZImageManager.m
| ... | ... | @@ -887,13 +887,16 @@ static dispatch_once_t onceToken; |
| 887 | 887 | // NSString *outputPath = [NSHomeDirectory() stringByAppendingFormat:@"/tmp/output-%@.mp4", [formater stringFromDate:[NSDate date]]]; |
| 888 | 888 | NSString *outputPath = @""; |
| 889 | 889 | if (self.conversationId) { |
| 890 | - outputPath = [[CNLiveBusinessTools newChatFilePathByUserId:self.conversationId] stringByAppendingPathComponent:filaName];//聊天 | |
| 890 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 891 | +// outputPath = [[CNLiveBusinessTools newChatFilePathByUserId:self.conversationId] stringByAppendingPathComponent:filaName];//聊天 | |
| 892 | + /////////////// | |
| 891 | 893 | |
| 892 | 894 | } |
| 893 | 895 | else |
| 894 | 896 | { |
| 895 | - | |
| 896 | - outputPath = [[CNLiveBusinessTools chatFilePathByUserId:[IMAPlatform sharedInstance].host.userId] stringByAppendingString:filaName];//朋友圈 | |
| 897 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 898 | +// outputPath = [[CNLiveBusinessTools chatFilePathByUserId:[IMAPlatform sharedInstance].host.userId] stringByAppendingString:filaName];//朋友圈 | |
| 899 | + /////////// | |
| 897 | 900 | } |
| 898 | 901 | NSLog(@"video outputPath = %@",outputPath); |
| 899 | 902 | ... | ... |
CNLiveImagePickerController/Classes/TZImagePickerController.m
| ... | ... | @@ -745,6 +745,7 @@ |
| 745 | 745 | |
| 746 | 746 | TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; |
| 747 | 747 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:imagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:imagePickerVc action:@selector(cancelButtonClick)]; |
| 748 | + [self.navigationItem.rightBarButtonItem setTintColor:[UIColor blackColor]]; | |
| 748 | 749 | } |
| 749 | 750 | |
| 750 | 751 | - (void)viewWillAppear:(BOOL)animated { | ... | ... |
CNLiveImagePickerController/Classes/TZPhotoPickerController.m
| ... | ... | @@ -18,8 +18,9 @@ |
| 18 | 18 | #import "TZLocationManager.h" |
| 19 | 19 | #import <MobileCoreServices/MobileCoreServices.h> |
| 20 | 20 | #import <AssetsLibrary/AssetsLibrary.h>///lxg |
| 21 | -#import "CNLiveUploadManager.h" | |
| 22 | - | |
| 21 | +#pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 22 | +//#import "CNLiveUploadManager.h" | |
| 23 | +/////////// | |
| 23 | 24 | @implementation PHAsset (Qiniu) |
| 24 | 25 | |
| 25 | 26 | - (NSURL *)movieURL { |
| ... | ... | @@ -697,14 +698,15 @@ static CGFloat itemMargin = 5; |
| 697 | 698 | |
| 698 | 699 | __block NSURL *returnURL = nil; |
| 699 | 700 | TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; |
| 700 | - | |
| 701 | - [CNLiveUploadManager zipNewVideoWithAsset:model.asset conversationId:tzImagePickerVc.conversationId limitType:AppPhototLimitTypeChat progressCount:^(float progress) { | |
| 702 | - | |
| 703 | - } success:^(NSURL *url) { | |
| 704 | - returnURL = url; | |
| 705 | - } failure:^{ | |
| 706 | - | |
| 707 | - }]; | |
| 701 | +#pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 702 | +// [CNLiveUploadManager zipNewVideoWithAsset:model.asset conversationId:tzImagePickerVc.conversationId limitType:AppPhototLimitTypeChat progressCount:^(float progress) { | |
| 703 | +// | |
| 704 | +// } success:^(NSURL *url) { | |
| 705 | +// returnURL = url; | |
| 706 | +// } failure:^{ | |
| 707 | +// | |
| 708 | +// }]; | |
| 709 | + //////////// | |
| 708 | 710 | |
| 709 | 711 | return returnURL; |
| 710 | 712 | ... | ... |
CNLiveImagePickerController/Classes/TZPhotoPreviewCell.m
| ... | ... | @@ -14,8 +14,11 @@ |
| 14 | 14 | #import "TZImageCropManager.h" |
| 15 | 15 | #import <MediaPlayer/MediaPlayer.h> |
| 16 | 16 | #import "TZImagePickerController.h" |
| 17 | -#import "CNAudioOrVideoMananger.h" | |
| 18 | 17 | |
| 18 | +#pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 19 | +//#import "CNAudioOrVideoMananger.h" | |
| 20 | +//#import "CNLiveSoundManager.h" | |
| 21 | +//////////////////////// | |
| 19 | 22 | @implementation TZAssetPreviewCell |
| 20 | 23 | |
| 21 | 24 | - (instancetype)initWithFrame:(CGRect)frame { |
| ... | ... | @@ -369,14 +372,15 @@ |
| 369 | 372 | |
| 370 | 373 | - (void)configSubviews { |
| 371 | 374 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil]; |
| 372 | - | |
| 373 | - [[NSNotificationCenter defaultCenter] addObserver:self | |
| 374 | - selector:@selector(pauseVideoView:) name:CNVideoOrAudioEnterNotification | |
| 375 | - object:nil]; | |
| 376 | - | |
| 377 | - [[NSNotificationCenter defaultCenter] addObserver:self | |
| 378 | - selector:@selector(playVideoView:) name:CNVideoOrAudioOutNotification | |
| 379 | - object:nil]; | |
| 375 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 376 | +// [[NSNotificationCenter defaultCenter] addObserver:self | |
| 377 | +// selector:@selector(pauseVideoView:) name:CNVideoOrAudioEnterNotification | |
| 378 | +// object:nil]; | |
| 379 | +// | |
| 380 | +// [[NSNotificationCenter defaultCenter] addObserver:self | |
| 381 | +// selector:@selector(playVideoView:) name:CNVideoOrAudioOutNotification | |
| 382 | +// object:nil]; | |
| 383 | + //////////////// | |
| 380 | 384 | |
| 381 | 385 | } |
| 382 | 386 | |
| ... | ... | @@ -662,12 +666,20 @@ |
| 662 | 666 | |
| 663 | 667 | - (void)playButtonClick { |
| 664 | 668 | |
| 665 | - if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 666 | - [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 667 | - return; | |
| 668 | - }else { | |
| 669 | - [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; | |
| 670 | - } | |
| 669 | +// if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 670 | +// [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 671 | +// return; | |
| 672 | +// }else { | |
| 673 | +// [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; | |
| 674 | +// } | |
| 675 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 676 | +// if ([[CNLiveSoundManager sharedInstance] isEnterChatAudio]) { | |
| 677 | +// [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 678 | +// return; | |
| 679 | +// }else { | |
| 680 | +// [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; | |
| 681 | +// } | |
| 682 | + ////////////////////////// | |
| 671 | 683 | |
| 672 | 684 | CMTime currentTime = _player.currentItem.currentTime; |
| 673 | 685 | CMTime durationTime = _player.currentItem.duration; | ... | ... |
CNLiveImagePickerController/Classes/TZPhotoPreviewController.m
| ... | ... | @@ -15,8 +15,9 @@ |
| 15 | 15 | #import "TZImageCropManager.h" |
| 16 | 16 | #import <AssetsLibrary/AssetsLibrary.h>///lxg |
| 17 | 17 | #import "CNEditVideoController.h" |
| 18 | -#import "CNAudioOrVideoMananger.h" | |
| 19 | 18 | |
| 19 | +//#import "CNAudioOrVideoMananger.h" | |
| 20 | +//#import "CNLiveSoundManager.h" | |
| 20 | 21 | @interface TZPhotoPreviewController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIScrollViewDelegate> { |
| 21 | 22 | UICollectionView *_collectionView; |
| 22 | 23 | UICollectionViewFlowLayout *_layout; |
| ... | ... | @@ -487,10 +488,17 @@ |
| 487 | 488 | ///lxg 编辑按钮实现 |
| 488 | 489 | - (void)editVideoButtonClick{ |
| 489 | 490 | |
| 490 | - if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 491 | - [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 492 | - return; | |
| 493 | - } | |
| 491 | + // if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 492 | + // [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 493 | + // return; | |
| 494 | + // } | |
| 495 | +#pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 496 | +// if ([[CNLiveSoundManager sharedInstance]isEnterChatAudio]) { | |
| 497 | +// [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 498 | +// return; | |
| 499 | +// } | |
| 500 | + ///////////////////////////////////// | |
| 501 | +// [[CNLiveSoundManager sharedInstance] audioOrVideoCalling]; | |
| 494 | 502 | |
| 495 | 503 | NSLog(@"开始编辑视频了"); |
| 496 | 504 | TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController; | ... | ... |
CNLiveImagePickerController/Classes/TZVideoPlayerController.m
| ... | ... | @@ -13,8 +13,10 @@ |
| 13 | 13 | #import "TZAssetModel.h" |
| 14 | 14 | #import "TZImagePickerController.h" |
| 15 | 15 | #import "TZPhotoPreviewController.h" |
| 16 | -#import "CNAudioOrVideoMananger.h" | |
| 17 | - | |
| 16 | +#pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 17 | +//#import "CNAudioOrVideoMananger.h" | |
| 18 | +//#import "CNLiveSoundManager.h" | |
| 19 | +//////////////////////////// | |
| 18 | 20 | @interface TZVideoPlayerController () { |
| 19 | 21 | AVPlayer *_player; |
| 20 | 22 | AVPlayerLayer *_playerLayer; |
| ... | ... | @@ -49,13 +51,17 @@ |
| 49 | 51 | } |
| 50 | 52 | [self configMoviePlayer]; |
| 51 | 53 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil]; |
| 52 | - [[NSNotificationCenter defaultCenter] addObserver:self | |
| 53 | - selector:@selector(pauseVideoView:) name:CNVideoOrAudioEnterNotification | |
| 54 | - object:nil]; | |
| 54 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 55 | +// [[NSNotificationCenter defaultCenter] addObserver:self | |
| 56 | +// selector:@selector(pauseVideoView:) name:CNVideoOrAudioEnterNotification | |
| 57 | +// object:nil]; | |
| 58 | +// | |
| 59 | +// [[NSNotificationCenter defaultCenter] addObserver:self | |
| 60 | +// selector:@selector(playVideoView:) name:CNVideoOrAudioOutNotification | |
| 61 | +// object:nil]; | |
| 62 | + ///////////////////////////// | |
| 55 | 63 | |
| 56 | - [[NSNotificationCenter defaultCenter] addObserver:self | |
| 57 | - selector:@selector(playVideoView:) name:CNVideoOrAudioOutNotification | |
| 58 | - object:nil]; | |
| 64 | +// [self videoOrAudioEnterOrOut]; | |
| 59 | 65 | } |
| 60 | 66 | #pragma mark - 添加: 导航栏(LXG) |
| 61 | 67 | - (void)viewWillAppear:(BOOL)animated { |
| ... | ... | @@ -193,14 +199,16 @@ |
| 193 | 199 | //完成按钮 |
| 194 | 200 | _doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; |
| 195 | 201 | [_doneButton setTitle:@"完成" forState:UIControlStateDisabled]; |
| 196 | - [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 197 | - [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 198 | - | |
| 199 | - //颜色绘制成图片 | |
| 200 | - UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 201 | - [_doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 202 | - UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 203 | - [_doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 202 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 203 | +// [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled]; | |
| 204 | +// [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; | |
| 205 | + | |
| 206 | +// //颜色绘制成图片 | |
| 207 | +// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)]; | |
| 208 | +// [_doneButton setBackgroundImage:dis_image forState:UIControlStateSelected]; | |
| 209 | +// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)]; | |
| 210 | +// [_doneButton setBackgroundImage:nor_image forState:UIControlStateNormal]; | |
| 211 | + ///////////////////////// | |
| 204 | 212 | _doneButton.layer.masksToBounds = YES; |
| 205 | 213 | _doneButton.layer.cornerRadius = 5; |
| 206 | 214 | CGRect frame = _toolBar.frame; |
| ... | ... | @@ -222,11 +230,16 @@ |
| 222 | 230 | |
| 223 | 231 | - (void)playButtonClick { |
| 224 | 232 | |
| 225 | - if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 226 | - [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 227 | - return; | |
| 228 | - } | |
| 229 | - | |
| 233 | +// if ([CNAudioOrVideoMananger IsEnter]) {//在房间 | |
| 234 | +// [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 235 | +// return; | |
| 236 | +// } | |
| 237 | + #pragma mark - TODO: 2019.11.12 需要其他库依赖 | |
| 238 | +// if ([[CNLiveSoundManager sharedInstance]isEnterChatAudio]) { | |
| 239 | +// [QMUITips showWithText:@"音视频通话中..." inView:AppKeyWindow hideAfterDelay:1.5]; | |
| 240 | +// return; | |
| 241 | +// } | |
| 242 | + ////////////////////// | |
| 230 | 243 | CMTime currentTime = _player.currentItem.currentTime; |
| 231 | 244 | CMTime durationTime = _player.currentItem.duration; |
| 232 | 245 | if (_player.rate == 0.0f) { |
| ... | ... | @@ -306,7 +319,7 @@ |
| 306 | 319 | // [UIApplication sharedApplication].statusBarHidden = NO; |
| 307 | 320 | // } |
| 308 | 321 | } |
| 309 | - | |
| 322 | +#pragma mark 收到进入音视频的通知 | |
| 310 | 323 | - (void)pauseVideoView:(NSNotification *)note |
| 311 | 324 | { |
| 312 | 325 | [self playButtonClick]; |
| ... | ... | @@ -314,11 +327,21 @@ |
| 314 | 327 | |
| 315 | 328 | - (void)playVideoView:(NSNotification *)note |
| 316 | 329 | { |
| 317 | - | |
| 318 | - | |
| 319 | -} | |
| 320 | 330 | |
| 321 | 331 | |
| 332 | +} | |
| 333 | +#pragma mark 收到进入音视频的通知 | |
| 334 | +//- (void)videoOrAudioEnterOrOut { | |
| 335 | +// __weak typeof(self) weakSelf = self; | |
| 336 | +// [CNLiveSoundManager sharedInstance].enterOrExitAudioBlock = ^(CNLiveAudioType type) { | |
| 337 | +// if (type == CNLiveAudioTypeEnter) { //进入音视频 | |
| 338 | +// [weakSelf playButtonClick]; | |
| 339 | +// }else if (type == CNLiveAudioTypeOut){ //退出音视频 | |
| 340 | +// | |
| 341 | +// } | |
| 342 | +// }; | |
| 343 | +//} | |
| 344 | + | |
| 322 | 345 | - (void)dealloc { |
| 323 | 346 | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 324 | 347 | } | ... | ... |
Example/CNLiveImagePickerController.xcodeproj/project.pbxproj
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | /* End PBXContainerItemProxy section */ |
| 38 | 38 | |
| 39 | 39 | /* Begin PBXFileReference section */ |
| 40 | - 1E186CDE862673840D64652F /* CNLiveImagePickerController.podspec */ = {isa = PBXFileReference; includeInIndex = 1; name = CNLiveImagePickerController.podspec; path = ../CNLiveImagePickerController.podspec; sourceTree = "<group>"; }; | |
| 40 | + 1E186CDE862673840D64652F /* CNLiveImagePickerController.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CNLiveImagePickerController.podspec; path = ../CNLiveImagePickerController.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; | |
| 41 | 41 | 251D01DF472ED3B34CCF79D7 /* Pods-CNLiveImagePickerController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveImagePickerController_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveImagePickerController_Tests/Pods-CNLiveImagePickerController_Tests.release.xcconfig"; sourceTree = "<group>"; }; |
| 42 | 42 | 2EFBCF51E613A31E4CA39B49 /* Pods-CNLiveImagePickerController_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveImagePickerController_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveImagePickerController_Example/Pods-CNLiveImagePickerController_Example.debug.xcconfig"; sourceTree = "<group>"; }; |
| 43 | 43 | 6003F58A195388D20070C39A /* CNLiveImagePickerController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveImagePickerController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| ... | ... | @@ -61,9 +61,9 @@ |
| 61 | 61 | 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; }; |
| 62 | 62 | 6774261442B1D13201144A37 /* Pods_CNLiveImagePickerController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveImagePickerController_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 63 | 63 | 71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; |
| 64 | - 804602CE4E7E104F5222073B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; name = README.md; path = ../README.md; sourceTree = "<group>"; }; | |
| 64 | + 804602CE4E7E104F5222073B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; }; | |
| 65 | 65 | 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; |
| 66 | - BF0D4829B7327822E0C4146E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; }; | |
| 66 | + BF0D4829B7327822E0C4146E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; }; | |
| 67 | 67 | C188B280A1A26E9C6D19D5C6 /* Pods-CNLiveImagePickerController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveImagePickerController_Example.release.xcconfig"; path = "Target Support Files/Pods-CNLiveImagePickerController_Example/Pods-CNLiveImagePickerController_Example.release.xcconfig"; sourceTree = "<group>"; }; |
| 68 | 68 | E4BA720C67B8EEEF52848A79 /* Pods_CNLiveImagePickerController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CNLiveImagePickerController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 69 | 69 | F2CA825BC87A414FD6AF3A37 /* Pods-CNLiveImagePickerController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveImagePickerController_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveImagePickerController_Tests/Pods-CNLiveImagePickerController_Tests.debug.xcconfig"; sourceTree = "<group>"; }; |
| ... | ... | @@ -193,7 +193,6 @@ |
| 193 | 193 | F2CA825BC87A414FD6AF3A37 /* Pods-CNLiveImagePickerController_Tests.debug.xcconfig */, |
| 194 | 194 | 251D01DF472ED3B34CCF79D7 /* Pods-CNLiveImagePickerController_Tests.release.xcconfig */, |
| 195 | 195 | ); |
| 196 | - name = Pods; | |
| 197 | 196 | path = Pods; |
| 198 | 197 | sourceTree = "<group>"; |
| 199 | 198 | }; |
| ... | ... | @@ -248,6 +247,9 @@ |
| 248 | 247 | LastUpgradeCheck = 0720; |
| 249 | 248 | ORGANIZATIONNAME = jyyjkt; |
| 250 | 249 | TargetAttributes = { |
| 250 | + 6003F589195388D20070C39A = { | |
| 251 | + DevelopmentTeam = 94X49GG3ZW; | |
| 252 | + }; | |
| 251 | 253 | 6003F5AD195388D20070C39A = { |
| 252 | 254 | TestTargetID = 6003F589195388D20070C39A; |
| 253 | 255 | }; |
| ... | ... | @@ -258,6 +260,7 @@ |
| 258 | 260 | developmentRegion = English; |
| 259 | 261 | hasScannedForEncodings = 0; |
| 260 | 262 | knownRegions = ( |
| 263 | + English, | |
| 261 | 264 | en, |
| 262 | 265 | Base, |
| 263 | 266 | ); |
| ... | ... | @@ -494,6 +497,7 @@ |
| 494 | 497 | baseConfigurationReference = 2EFBCF51E613A31E4CA39B49 /* Pods-CNLiveImagePickerController_Example.debug.xcconfig */; |
| 495 | 498 | buildSettings = { |
| 496 | 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 500 | + DEVELOPMENT_TEAM = 94X49GG3ZW; | |
| 497 | 501 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 498 | 502 | GCC_PREFIX_HEADER = "CNLiveImagePickerController/CNLiveImagePickerController-Prefix.pch"; |
| 499 | 503 | INFOPLIST_FILE = "CNLiveImagePickerController/CNLiveImagePickerController-Info.plist"; |
| ... | ... | @@ -510,6 +514,7 @@ |
| 510 | 514 | baseConfigurationReference = C188B280A1A26E9C6D19D5C6 /* Pods-CNLiveImagePickerController_Example.release.xcconfig */; |
| 511 | 515 | buildSettings = { |
| 512 | 516 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 517 | + DEVELOPMENT_TEAM = 94X49GG3ZW; | |
| 513 | 518 | GCC_PRECOMPILE_PREFIX_HEADER = YES; |
| 514 | 519 | GCC_PREFIX_HEADER = "CNLiveImagePickerController/CNLiveImagePickerController-Prefix.pch"; |
| 515 | 520 | INFOPLIST_FILE = "CNLiveImagePickerController/CNLiveImagePickerController-Info.plist"; | ... | ... |
Example/Podfile
| 1 | 1 | use_frameworks! |
| 2 | +source 'https://github.com/CocoaPods/Specs.git' | |
| 3 | +source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git' | |
| 2 | 4 | |
| 3 | 5 | platform :ios, '8.0' |
| 4 | 6 | |
| 5 | 7 | target 'CNLiveImagePickerController_Example' do |
| 6 | 8 | pod 'CNLiveImagePickerController', :path => '../' |
| 9 | + | |
| 10 | + #pod 'CNLiveBaseKit' | |
| 7 | 11 | |
| 8 | 12 | target 'CNLiveImagePickerController_Tests' do |
| 9 | 13 | inherit! :search_paths | ... | ... |