ELCImagePickerController 的集成

田曜瑞
2023-12-01
  • 1,  将文件夹ELCImagePicker拷贝到工程中
  • 2,添加系统库AssetsLibrary.framework
  • 3,  添加系统库MobileCoreServices
  • 4,在头文件中加入引用#import "ELCImagePickerHeader.h"
  • 5,在头文件中加入delegate的引用ELCImagePickerControllerDelegate
  • 6,  替换之前的UIImagePickerController相关的初始化代码为

        ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initImagePicker];
        elcPicker.maximumImagesCount = 100; //Set the maximum number of images to select to 100
        elcPicker.returnsOriginalImage = YES; //Only return the fullScreenImage, not the fullResolutionImage
        elcPicker.returnsImage = YES; //Return UIimage if YES. If NO, only return asset location information
        elcPicker.onOrder = YES; //For multiple image selection, display and return order of selected images
        elcPicker.mediaTypes = @[(NSString *)kUTTypeImage, (NSString *)kUTTypeMovie]; //Supports image and movie types
        elcPicker.imagePickerDelegate = self;
        [self.navigationController presentViewController:elcPicker animated:YES completion:nil];

  • 7, 屏蔽之前的didFinishPickingMediaWithInfo 和 imagePickerControllerDidCancel而替换成

  - (void)elcImagePickerControllerDidCancel:(ELCImagePickerController *)picker
    {
        [self dismissViewControllerAnimated:YES completion:nil];
    }

  - (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info{
    
        [picker dismissViewControllerAnimated:YES completion:nil];
    }

 

转载于:https://www.cnblogs.com/lisa090818/p/4424322.html

 类似资料: