数据枚举类型 - PhotosTypes.h
介绍PhotosTypes.h文件中申明的枚举类型,部分枚举类型作为获取assets时的筛选条件。
- 使图像的宽高比符合请求大小的选项
PHImageContentMode
typedef NS_ENUM(NSInteger, PHImageContentMode) {
PHImageContentModeAspectFit = 0,
PHImageContentModeAspectFill = 1,
PHImageContentModeDefault = PHImageContentModeAspectFit
};
- PHCollection
PHCollectionEditOperation
typedef NS_ENUM(NSInteger, PHCollectionEditOperation) {
PHCollectionEditOperationDeleteContent = 1, // Delete things it contains
PHCollectionEditOperationRemoveContent = 2, // Remove things it contains, they're not deleted from the library
PHCollectionEditOperationAddContent = 3, // Add things from other collection
PHCollectionEditOperationCreateContent = 4, // Create new things, or duplicate them from others in the same container
PHCollectionEditOperationRearrangeContent = 5, // Change the order of things
PHCollectionEditOperationDelete = 6, // Deleting of the container, not the content
PHCollectionEditOperationRename = 7, // Renaming of the container, not the content
};
- PHCollectionList 的枚举类型
PHCollectionListType
typedef NS_ENUM(NSInteger, PHCollectionListType) {
PHCollectionListTypeMomentList API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 1,
PHCollectionListTypeFolder = 2,
PHCollectionListTypeSmartFolder = 3,
};
PHCollectionListSubtype
typedef NS_ENUM(NSInteger, PHCollectionListSubtype) {
// PHCollectionListTypeMomentList subtypes
PHCollectionListSubtypeMomentListCluster API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 1,
PHCollectionListSubtypeMomentListYear API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 2,
// PHCollectionListTypeFolder subtypes
PHCollectionListSubtypeRegularFolder = 100,
// PHCollectionListTypeSmartFolder subtypes
PHCollectionListSubtypeSmartFolderEvents = 200,
PHCollectionListSubtypeSmartFolderFaces = 201,
// Used for fetching if you don't care about the exact subtype
PHCollectionListSubtypeAny = NSIntegerMax
};
- PHAssetCollection
PHAssetCollectionType
typedef NS_ENUM(NSInteger, PHAssetCollectionType) {
PHAssetCollectionTypeAlbum = 1, //在 照片 应用中创建的相簿或者通过iTunes同步的在iOS设备上显示的相簿
PHAssetCollectionTypeSmartAlbum = 2, //照片 应用中内置的相簿
PHAssetCollectionTypeMoment API_DEPRECATED("Will be removed in a future release", ios(8, 13), tvos(10, 13)) API_UNAVAILABLE(macos) = 3, //照片 应用中的 时刻
};
PHAssetCollectionSubtype
typedef NS_ENUM(NSInteger, PHAssetCollectionSubtype) {
// PHAssetCollectionTypeAlbum regular subtypes
PHAssetCollectionSubtypeAlbumRegular = 2, //在照片应用程序中创建的相册
PHAssetCollectionSubtypeAlbumSyncedEvent = 3, //从 iPhoto 中同步到设备的 事件
PHAssetCollectionSubtypeAlbumSyncedFaces = 4, //从 iPhoto 中同步到设备的 面孔(人物)
PHAssetCollectionSubtypeAlbumSyncedAlbum = 5, //从 iPhoto 中同步到设备的相簿
PHAssetCollectionSubtypeAlbumImported = 6, //从相机或者外部存储设备中导入的相簿
// PHAssetCollectionTypeAlbum shared subtypes
PHAssetCollectionSubtypeAlbumMyPhotoStream = 100, //用户自己的iCloud照片流
PHAssetCollectionSubtypeAlbumCloudShared = 101, //一个iCloud共享照片流
// PHAssetCollectionTypeSmartAlbum subtypes
PHAssetCollectionSubtypeSmartAlbumGeneric = 200,
PHAssetCollectionSubtypeSmartAlbumPanoramas = 201,
PHAssetCollectionSubtypeSmartAlbumVideos = 202,
PHAssetCollectionSubtypeSmartAlbumFavorites = 203,
PHAssetCollectionSubtypeSmartAlbumTimelapses = 204,
PHAssetCollectionSubtypeSmartAlbumAllHidden = 205,
PHAssetCollectionSubtypeSmartAlbumRecentlyAdded = 206,
PHAssetCollectionSubtypeSmartAlbumBursts = 207,
PHAssetCollectionSubtypeSmartAlbumSlomoVideos = 208,
PHAssetCollectionSubtypeSmartAlbumUserLibrary = 209,
PHAssetCollectionSubtypeSmartAlbumSelfPortraits API_AVAILABLE(ios(9)) = 210,
PHAssetCollectionSubtypeSmartAlbumScreenshots API_AVAILABLE(ios(9)) = 211,
PHAssetCollectionSubtypeSmartAlbumDepthEffect API_AVAILABLE(macos(10.13), ios(10.2), tvos(10.1)) = 212,
PHAssetCollectionSubtypeSmartAlbumLivePhotos API_AVAILABLE(macos(10.13), ios(10.3), tvos(10.2)) = 213,
PHAssetCollectionSubtypeSmartAlbumAnimated API_AVAILABLE(macos(10.15), ios(11), tvos(11)) = 214,
PHAssetCollectionSubtypeSmartAlbumLongExposures API_AVAILABLE(macos(10.15), ios(11), tvos(11)) = 215,
PHAssetCollectionSubtypeSmartAlbumUnableToUpload API_AVAILABLE(macos(10.15), ios(13), tvos(13)) = 216,
// Used for fetching, if you don't care about the exact subtype
PHAssetCollectionSubtypeAny = NSIntegerMax
};
- PHAsset
PHAssetEditOperation
typedef NS_ENUM(NSInteger, PHAssetEditOperation) {
PHAssetEditOperationDelete = 1, //可删除
PHAssetEditOperationContent = 2, //可编辑asset内容
PHAssetEditOperationProperties = 3, //可编辑asset属性
};
PHAssetPlaybackStyle
typedef NS_ENUM(NSInteger, PHAssetPlaybackStyle) {
PHAssetPlaybackStyleUnsupported = 0,
PHAssetPlaybackStyleImage = 1, //表示asset应显示为静止图像
PHAssetPlaybackStyleImageAnimated = 2, //表示asset应显示为动画图像
PHAssetPlaybackStyleLivePhoto = 3, //表示asset应显示为Live Photo
PHAssetPlaybackStyleVideo = 4, //表示asset应显示为视频
PHAssetPlaybackStyleVideoLooping = 5, //表示asset应显示为循环视频
} API_AVAILABLE(macos(10.13), ios(11), tvos(11)) NS_SWIFT_NAME(PHAsset.PlaybackStyle);
tips:什么是Live Photo? 动态壁纸。LivePhoto包含两个部分,一部分是一张jpg图片,一部分则是一个mov视频。
PHAssetMediaType & PHAssetMediaSubtype
typedef NS_ENUM(NSInteger, PHAssetMediaType) {
PHAssetMediaTypeUnknown = 0,
PHAssetMediaTypeImage = 1,
PHAssetMediaTypeVideo = 2,
PHAssetMediaTypeAudio = 3, //音频
};
typedef NS_OPTIONS(NSUInteger, PHAssetMediaSubtype) {
PHAssetMediaSubtypeNone = 0,
// Photo subtypes
PHAssetMediaSubtypePhotoPanorama = (1UL << 0),
PHAssetMediaSubtypePhotoHDR = (1UL << 1),
PHAssetMediaSubtypePhotoScreenshot API_AVAILABLE(ios(9)) = (1UL << 2),
PHAssetMediaSubtypePhotoLive API_AVAILABLE(ios(9.1)) = (1UL << 3),
PHAssetMediaSubtypePhotoDepthEffect API_AVAILABLE(macos(10.12.2), ios(10.2), tvos(10.1)) = (1UL << 4),
// Video subtypes
PHAssetMediaSubtypeVideoStreamed = (1UL << 16),
PHAssetMediaSubtypeVideoHighFrameRate = (1UL << 17),
PHAssetMediaSubtypeVideoTimelapse = (1UL << 18),
};
Note:同上一个枚举类型的区别,PHAssetMediaType是标识资源种类的枚举类,PHAssetPlaybackStyle代表的是资源的打开方式。
PHAssetBurstSelectionType
typedef NS_OPTIONS(NSUInteger, PHAssetBurstSelectionType) {
PHAssetBurstSelectionTypeNone = 0,
PHAssetBurstSelectionTypeAutoPick = (1UL << 0), //自动选中
PHAssetBurstSelectionTypeUserPick = (1UL << 1), //用户选中
};
PHAssetSourceType - asset加入Photos的方式
typedef NS_OPTIONS(NSUInteger, PHAssetSourceType) {
PHAssetSourceTypeNone = 0,
PHAssetSourceTypeUserLibrary = (1UL << 0),
PHAssetSourceTypeCloudShared = (1UL << 1), //来源于iCloud共享相册
PHAssetSourceTypeiTunesSynced = (1UL << 2), //该资产来源于Mac或PC,并通过iTunes同步呈现在设备上
} API_AVAILABLE(ios(9));
PHAssetResourceType
typedef NS_ENUM(NSInteger, PHAssetResourceType) {
PHAssetResourceTypePhoto = 1,
PHAssetResourceTypeVideo = 2,
PHAssetResourceTypeAudio = 3,
PHAssetResourceTypeAlternatePhoto = 4,
PHAssetResourceTypeFullSizePhoto = 5,
PHAssetResourceTypeFullSizeVideo = 6,
PHAssetResourceTypeAdjustmentData = 7,
PHAssetResourceTypeAdjustmentBasePhoto = 8,
PHAssetResourceTypePairedVideo API_AVAILABLE(ios(9.1)) = 9,
PHAssetResourceTypeFullSizePairedVideo API_AVAILABLE(macos(10.15), ios(10)) = 10,
PHAssetResourceTypeAdjustmentBasePairedVideo API_AVAILABLE(macos(10.15), ios(10)) = 11,
PHAssetResourceTypeAdjustmentBaseVideo API_AVAILABLE(macos(10.15), ios(13)) = 12,
} API_AVAILABLE(ios(9));