Commit 944dc7e5f2bfb8d26fdc18be6f56b9881e7074ec
1 parent
b6b50741
0.0.27 版本 修改取消按钮不显示
完成按钮错位
Showing
5 changed files
with
55 additions
and
23 deletions
CNLiveImagePickerController.podspec
CNLiveImagePickerController/Classes/CNImagePickerController.m
| ... | ... | @@ -254,34 +254,38 @@ |
| 254 | 254 | [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { |
| 255 | 255 | |
| 256 | 256 | CGRect frame = bottomToolBar.frame; |
| 257 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 257 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 258 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, 12, 60, 30); | |
| 258 | 259 | |
| 259 | 260 | CGRect originalPhotoLabelFrame = originalPhotoLabel.frame; |
| 260 | 261 | CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2; |
| 261 | 262 | CGFloat originalY = originalPhotoLabelFrame.origin.y; |
| 262 | 263 | originalPhotoButton.frame = CGRectMake(originalX, originalY, originalPhotoLabelFrame.size.width, originalPhotoLabelFrame.size.height); |
| 263 | 264 | |
| 264 | - | |
| 265 | 265 | }]; |
| 266 | 266 | //图片预览 |
| 267 | 267 | [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) { |
| 268 | 268 | [backButton setImage:[UIImage imageNamedFromMyBundle:@"navi_back"] forState:UIControlStateNormal]; |
| 269 | 269 | CGRect frame = toolBar.frame; |
| 270 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 270 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 271 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, 15, 60, 30); | |
| 272 | + | |
| 271 | 273 | |
| 272 | 274 | }]; |
| 273 | 275 | //视频预览 |
| 274 | 276 | [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) { |
| 275 | 277 | |
| 276 | 278 | CGRect frame = toolBar.frame; |
| 277 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 279 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 280 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, 12, 60, 30); | |
| 278 | 281 | |
| 279 | 282 | }]; |
| 280 | 283 | //gif预览 |
| 281 | 284 | [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) { |
| 282 | 285 | |
| 283 | 286 | CGRect frame = toolBar.frame; |
| 284 | - doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 287 | +// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30); | |
| 288 | + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, 12, 60, 30); | |
| 285 | 289 | |
| 286 | 290 | }]; |
| 287 | 291 | //相册cell | ... | ... |
CNLiveImagePickerController/Classes/CNTZImagePickerController.m
| ... | ... | @@ -744,7 +744,7 @@ |
| 744 | 744 | self.view.backgroundColor = [UIColor whiteColor]; |
| 745 | 745 | |
| 746 | 746 | CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController; |
| 747 | - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:imagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:imagePickerVc action:@selector(cancelButtonClick)]; | |
| 747 | + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:imagePickerVc action:@selector(cancelButtonClick)]; | |
| 748 | 748 | [self.navigationItem.rightBarButtonItem setTintColor:[UIColor blackColor]]; |
| 749 | 749 | } |
| 750 | 750 | ... | ... |
Example/CNLiveImagePickerController.xcodeproj/project.pbxproj
| ... | ... | @@ -554,7 +554,7 @@ |
| 554 | 554 | GCC_PREFIX_HEADER = "CNLiveImagePickerController/CNLiveImagePickerController-Prefix.pch"; |
| 555 | 555 | INFOPLIST_FILE = "CNLiveImagePickerController/CNLiveImagePickerController-Info.plist"; |
| 556 | 556 | MODULE_NAME = ExampleApp; |
| 557 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug; | |
| 557 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug1; | |
| 558 | 558 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 559 | 559 | SWIFT_VERSION = 4.0; |
| 560 | 560 | WRAPPER_EXTENSION = app; |
| ... | ... | @@ -571,7 +571,7 @@ |
| 571 | 571 | GCC_PREFIX_HEADER = "CNLiveImagePickerController/CNLiveImagePickerController-Prefix.pch"; |
| 572 | 572 | INFOPLIST_FILE = "CNLiveImagePickerController/CNLiveImagePickerController-Info.plist"; |
| 573 | 573 | MODULE_NAME = ExampleApp; |
| 574 | - PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug; | |
| 574 | + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.CNLiveNetAdd.debug1; | |
| 575 | 575 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 576 | 576 | SWIFT_VERSION = 4.0; |
| 577 | 577 | WRAPPER_EXTENSION = app; | ... | ... |
Example/CNLiveImagePickerController/CNLiveViewController.m
| ... | ... | @@ -157,26 +157,54 @@ |
| 157 | 157 | // |
| 158 | 158 | // [self presentViewController:imagePickerVc animated:YES completion:nil]; |
| 159 | 159 | |
| 160 | - | |
| 161 | - | |
| 162 | - CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithMaxImagesCount:9 delegate:self]; | |
| 160 | + CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithMaxImagesCount:9 columnNumber:4 delegate:nil pushPhotoPickerVc:YES]; | |
| 163 | 161 | imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; |
| 164 | - imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 | |
| 165 | - imagePickerVc.allowPreview = NO; | |
| 166 | - imagePickerVc.allowPickingOriginalPhoto = NO; | |
| 167 | - imagePickerVc.allowPickingVideo = YES; | |
| 162 | + [imagePickerVc configCNTZImagePicker];//配置 | |
| 163 | +#pragma mark - 五类个性化设置,这些参数都可以不传,此时会走默认设置 | |
| 164 | + imagePickerVc.isSelectOriginalPhoto = NO;//是否选择原图 | |
| 165 | + // 1.设置目前已经选中的图片数组 | |
| 166 | +// imagePickerVc.selectedAssets = CNLiveLifeCirCleViewModelManager.selectedAssets; // 目前已经选中的图片数组 | |
| 167 | +// imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度 | |
| 168 | +// imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度 | |
| 169 | + // 3. Set allow picking video & photo & originalPhoto or not | |
| 170 | + // 3. 设置是否可以选择视频/图片/原图 | |
| 171 | + imagePickerVc.allowPickingMultipleVideo = NO; | |
| 172 | + /// 5. Single selection mode, valid when maxImagesCount = 1 | |
| 173 | + /// 5. 单选模式,maxImagesCount为1时才生效 | |
| 174 | + // 设置竖屏下的裁剪尺寸 | |
| 175 | + NSInteger left = 30; | |
| 176 | + NSInteger widthHeight = KScreenWidth - 2 * left; | |
| 177 | + NSInteger top = (KScreenHeight - widthHeight) / 2; | |
| 178 | + imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight); | |
| 168 | 179 | |
| 180 | +#pragma mark - 到这里为止 | |
| 181 | + // You can get the photos by block, the same as by delegate. | |
| 182 | + // 你可以通过block或者代理,来得到用户选择的照片. | |
| 169 | 183 | [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { |
| 170 | - UIImage *image = photos.firstObject; | |
| 171 | - if (image) { | |
| 172 | - | |
| 173 | - NSLog(@"发送的图过大 = %@",image); | |
| 174 | - } | |
| 175 | - | |
| 176 | - | |
| 177 | 184 | |
| 178 | 185 | }]; |
| 186 | + | |
| 179 | 187 | [self presentViewController:imagePickerVc animated:YES completion:nil]; |
| 188 | + | |
| 189 | + | |
| 190 | +// CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithMaxImagesCount:9 delegate:self]; | |
| 191 | +// imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen; | |
| 192 | +// imagePickerVc.allowTakePicture = NO; // 在内部显示拍照按钮 | |
| 193 | +// imagePickerVc.allowPreview = NO; | |
| 194 | +// imagePickerVc.allowPickingOriginalPhoto = NO; | |
| 195 | +// imagePickerVc.allowPickingVideo = YES; | |
| 196 | +// | |
| 197 | +// [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { | |
| 198 | +// UIImage *image = photos.firstObject; | |
| 199 | +// if (image) { | |
| 200 | +// | |
| 201 | +// NSLog(@"发送的图过大 = %@",image); | |
| 202 | +// } | |
| 203 | +// | |
| 204 | +// | |
| 205 | +// | |
| 206 | +// }]; | |
| 207 | +// [self presentViewController:imagePickerVc animated:YES completion:nil]; | |
| 180 | 208 | |
| 181 | 209 | |
| 182 | 210 | ... | ... |