HXPhotoPicker icon indicating copy to clipboard operation
HXPhotoPicker copied to clipboard

请问一下一直想加个仅仅允许拍照的情况,加在这里没得别的问题吧?

Open xuyao199277 opened this issue 5 years ago • 2 comments

/** 是否只有相机功能 默认 NO */ @property (assign, nonatomic) BOOL onlyCamera;

  • (void)goPhotoViewController { if (!self.manager.cameraRollAlbumModel) { [self.manager preloadData]; } if (self.onlyCamera) { if (self.manager.type == HXPhotoManagerSelectedTypePhoto) { self.manager.configuration.maxNum = self.manager.configuration.photoMaxNum; }else if (self.manager.type == HXPhotoManagerSelectedTypeVideo) { self.manager.configuration.maxNum = self.manager.configuration.videoMaxNum; }else { // 防错 if (self.manager.configuration.videoMaxNum + self.manager.configuration.photoMaxNum != self.manager.configuration.maxNum) { self.manager.configuration.maxNum = self.manager.configuration.videoMaxNum + self.manager.configuration.photoMaxNum; } } UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle hx_localizedStringForKey:@"相机"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [self goCameraViewController]; }]]; [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle hx_localizedStringForKey:@"取消"] style:UIAlertActionStyleCancel handler:nil]]; [self.hx_viewController presentViewController:alertController animated:YES completion:nil]; // UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:[NSBundle hx_localizedStringForKey:@"取消"] destructiveButtonTitle:nil otherButtonTitles:[NSBundle hx_localizedStringForKey:@"相机"],[NSBundle hx_localizedStringForKey:@"相册"], nil]; // // [sheet showInView:self]; return; } if (self.outerCamera) { if (self.manager.type == HXPhotoManagerSelectedTypePhoto) { if (self.manager.configuration.photoMaxNum > 0) { self.manager.configuration.maxNum = self.manager.configuration.photoMaxNum; } }else if (self.manager.type == HXPhotoManagerSelectedTypeVideo) { if (self.manager.configuration.videoMaxNum > 0) { self.manager.configuration.maxNum = self.manager.configuration.videoMaxNum; } }else { if (self.manager.configuration.photoMaxNum > 0 && self.manager.configuration.videoMaxNum > 0) { self.manager.configuration.maxNum = self.manager.configuration.videoMaxNum + self.manager.configuration.photoMaxNum; } } UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { UIPopoverPresentationController *pop = [alertController popoverPresentationController]; pop.permittedArrowDirections = UIPopoverArrowDirectionAny; pop.sourceView = self; pop.sourceRect = self.bounds; } [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle hx_localizedStringForKey:@"相机"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [self goCameraViewController]; }]];

      [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle hx_localizedStringForKey:@"相册"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
          [self directGoPhotoViewController];
      }]];
    
      [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle hx_localizedStringForKey:@"取消"] style:UIAlertActionStyleCancel handler:nil]];
      [self.hx_viewController presentViewController:alertController animated:YES completion:nil];
      return;
    

    } [self directGoPhotoViewController]; }

xuyao199277 avatar May 23 '19 07:05 xuyao199277

good

harveyseeking avatar Jun 05 '19 08:06 harveyseeking

666

lifengdev avatar Sep 04 '19 09:09 lifengdev