其他分享
首页 > 其他分享> > Swift相册照片选择-支持单选或多选

Swift相册照片选择-支持单选或多选

作者:互联网

//
//  NAPublishAlbumTableViewController.swift
////
//  Created by  on 2019/3/23.
//  Copyright © 2019年 . All rights reserved.
//

import UIKit
import Photos

typealias HandlePhotos = ([PHAsset], [UIImage]) -> Void
class HandleSelectionPhotosManager: NSObject {
    static let share = HandleSelectionPhotosManager()
    
    var maxCount: Int = 0
    var callbackPhotos: HandlePhotos?
    
    private override init() {
        super.init()
    }
    
    func getSelectedPhotos(with count: Int, callback completeHandle: HandlePhotos? ) {
        // 限制长度
        maxCount = count < 1 ? 1 : (count > 9 ? 9 : count)
        self.callbackPhotos = completeHandle
    }
}

/// 后期可用来对相应的英文文件夹修改为汉语名,暂时未使用
enum AlbumTransformChina: String {
    case Favorites
    case RecentlyDeleted = "Recently Deleted"
    case Screenshots
    
    func chinaName() -> String {
        switch  self {
        case .Favorites:
            return "最爱"
        case .RecentlyDeleted:
            return "最近删除"
        case .Screenshots:
            return "手机截屏"
        }
    }
}


/// - albumAllPhotos: 所有
/// - albumSmartAlbums: 智能
/// - albumUserCollection: 收藏
enum AlbumSession: Int {
    case albumAllPhotos = 0
    case albumSmartAlbums
    case albumUserCollection
    
    static let count = 2
}
class NAPublishAlbumTableViewController : UITableViewController{
    // MARK: - 

标签:indexPath,或多选,self,width,let,func,var,单选,Swift
来源: https://www.cnblogs.com/xjf125/p/10595168.html