ImagePickerController

open class ImagePickerController : UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, ImagePickerPreviewControllerDelegate, ToolbarTitleViewDelegate

Undocumented

  • Undocumented

    Declaration

    Swift

    open weak var imagePickerControllerDelegate: ImagePickerControllerDelegate?
  • 自定义预览控制器句柄,优先级低于delegate

    Declaration

    Swift

    open var previewControllerBlock: (() -> ImagePickerPreviewController)?
  • 自定义相册控制器句柄,优先级低于delegate

    Declaration

    Swift

    open var albumControllerBlock: (() -> ImageAlbumController)?
  • 自定义cell展示句柄,cellForItem自动调用,优先级低于delegate

    Declaration

    Swift

    open var customCellBlock: ((_ cell: ImagePickerCollectionCell, _ indexPath: IndexPath) -> Void)?
  • 图片选取完成回调句柄,优先级低于delegate

    Declaration

    Swift

    open var didFinishPicking: (([Asset]) -> Void)?
  • 图片选取取消回调句柄,优先级低于delegate

    Declaration

    Swift

    open var didCancelPicking: (() -> Void)?
  • Undocumented

    Declaration

    Swift

    open var toolbarBackgroundColor: UIColor? { get set }
  • Undocumented

    Declaration

    Swift

    open var toolbarTintColor: UIColor? { get set }
  • 标题视图accessoryImage,默认nil,contentType方式会自动设置

    Declaration

    Swift

    open var titleAccessoryImage: UIImage?
  • 图片的最小尺寸,布局时如果有剩余空间,会将空间分配给图片大小,所以最终显示出来的大小不一定等于minimumImageWidth。默认是75。 collectionViewLayout 和 collectionView 可能有设置 sectionInsets 和 contentInsets,所以设置几行不可以简单的通过 screenWdith / columnCount 来获得

    Declaration

    Swift

    open var minimumImageWidth: CGFloat { get set }
  • 图片显示列数,默认0使用minimumImageWidth自动计算,指定后固定列数

    Declaration

    Swift

    open var imageColumnCount: Int { get set }
  • Undocumented

    Declaration

    Swift

    open var toolbarPaddingHorizontal: CGFloat
  • 自定义工具栏高度,默认同系统

    Declaration

    Swift

    open var operationToolbarHeight: CGFloat { get set }
  • Undocumented

    Declaration

    Swift

    open private(set) var imagesAssetArray: [Asset] { get }
  • Undocumented

    Declaration

    Swift

    open private(set) var assetsGroup: AssetGroup? { get }
  • 图片过滤类型,默认0不过滤,影响requestImage结果和previewController预览效果

    Declaration

    Swift

    open var filterType: ImagePickerFilterType
  • 自定义视频导出质量,默认nil时为AVAssetExportPresetMediumQuality

    Declaration

    Swift

    open var videoExportPreset: String?
  • 是否视频导出为AVAsset,默认false

    Declaration

    Swift

    open var videoExportAVAsset: Bool
  • 当前被选择的图片对应的 Asset 对象数组

    Declaration

    Swift

    open internal(set) var selectedImageAssetArray: [Asset] { get }
  • 是否允许图片多选,默认为 YES。如果为 NO,则不显示 checkbox 和底部工具栏

    Declaration

    Swift

    open var allowsMultipleSelection: Bool { get set }
  • 是否禁用预览时左右滚动,默认NO。如果为YES,单选时不能左右滚动切换图片

    Declaration

    Swift

    open var previewScrollDisabled: Bool
  • 最多可以选择的图片数,默认为9

    Declaration

    Swift

    open var maximumSelectImageCount: UInt
  • 最少需要选择的图片数,默认为 0

    Declaration

    Swift

    open var minimumSelectImageCount: UInt
  • 是否显示默认loading,优先级低于delegate,默认YES

    Declaration

    Swift

    open var showsDefaultLoading: Bool
  • 是否需要请求图片资源,默认NO,开启后会先requestImagesAssetArray再回调didFinishPicking

    Declaration

    Swift

    open var shouldRequestImage: Bool
  • 当前titleView,默认不可点击,contentType方式会自动切换点击状态

    Declaration

    Swift

    open lazy var titleView: ToolbarTitleView { get set }
  • Undocumented

    Declaration

    Swift

    open lazy var collectionView: UICollectionView { get set }
  • Undocumented

    Declaration

    Swift

    open lazy var collectionViewLayout: UICollectionViewFlowLayout { get set }
  • Undocumented

    Declaration

    Swift

    open lazy var operationToolbarView: UIView { get set }
  • Undocumented

    Declaration

    Swift

    open lazy var sendButton: UIButton { get set }
  • Undocumented

    Declaration

    Swift

    open lazy var previewButton: UIButton { get set }
  • Undocumented

    Declaration

    Swift

    public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?)
  • Undocumented

    Declaration

    Swift

    public required init?(coder: NSCoder)
  • Undocumented

    Declaration

    Swift

    open override func viewDidLoad()
  • Undocumented

    Declaration

    Swift

    open override func viewWillAppear(_ animated: Bool)
  • Undocumented

    Declaration

    Swift

    open override func viewDidLayoutSubviews()
  • Undocumented

    Declaration

    Swift

    open override var prefersStatusBarHidden: Bool { get }
  • Undocumented

    Declaration

    Swift

    open override var preferredStatusBarStyle: UIStatusBarStyle { get }
  • 图片过滤类型转换为相册内容类型

    Declaration

    Swift

    open class func albumContentType(filterType: ImagePickerFilterType) -> AlbumContentType
  • 检查并下载一组资源,如果资源仍未从 iCloud 中成功下载,则会发出请求从 iCloud 加载资源,下载完成后,主线程回调。 图片资源对象和结果信息保存在Asset.requestObject,自动根据过滤类型返回UIImage|PHLivePhoto|NSURL

    Declaration

    Swift

    open class func requestImagesAssetArray(
        _ imagesAssetArray: [Asset],
        filterType: ImagePickerFilterType,
        useOriginImage: Bool,
        videoExportPreset: String? = nil,
        videoExportAVAsset: Bool = false,
        completion: (() -> Void)?
    )
  • 也可以直接传入 AssetGroup,然后读取其中的 Asset 并储存到 imagesAssetArray 中,传入后会赋值到 AssetGroup,并自动刷新 UI 展示

    Declaration

    Swift

    open func refresh(assetsGroup: AssetGroup?)
  • 根据filterType刷新,自动选取第一个符合条件的相册,自动初始化并使用albumController

    Declaration

    Swift

    open func refresh(filterType: ImagePickerFilterType)

UICollectionView

  • Undocumented

    Declaration

    Swift

    open func numberOfSections(in collectionView: UICollectionView) -> Int
  • Undocumented

    Declaration

    Swift

    open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
  • Undocumented

    Declaration

    Swift

    open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
  • Undocumented

    Declaration

    Swift

    open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
  • Undocumented

    Declaration

    Swift

    open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)

ToolbarTitleViewDelegate