Platforms to show: All Mac Windows Linux Cross-Platform
PHCachingImageManagerMBS class
Super class: PHImageManagerMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Photos | MBS Mac64bit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
For quick performance when you are working with many assets, a caching image manager can prepare asset images in the background in order to eliminate delays when you later request individual images. For example, use a caching image manager when you want to populate a collection view or similar UI with thumbnails of photo or video assets.
Much of the key functionality of the PHCachingImageManager class is defined by its superclass, PHImageManagerMBS. For details, see PHImageManagerMBS.
To use a caching image manager:
1. Create a PHCachingImageManager instance. (This step replaces using the shared PHImageManager instance.)
2. Use PHAsset class methods to fetch the assets you’re interested in.
3. To prepare images for those assets, call the startCachingImagesForAssets:targetSize:contentMode:options: method with the target size, content mode, and options you plan to use when later requesting images for each individual asset.
4. When you need an image for an individual asset, call the requestImageForAsset:targetSize:contentMode:options:resultHandler: method, and pass the same parameters you used when preparing that asset.
If the image you request is among those already prepared, the PHCachingImageManager object immediately returns that image. Otherwise, Photos prepares the image on demand and caches it for later use.
Subclass of the PHImageManagerMBS class.
- property allowsCachingHighQualityImages as Boolean
- 4 methods
- method Constructor
- method startCachingImagesForAssets(assets() as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS = nil)
- method stopCachingImagesForAllAssets
- method stopCachingImagesForAssets(assets() as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS = nil)
- shared method available as boolean
Super class PHImageManagerMBS
- property Handle as Integer
- 9 methods
- method cancelImageRequest(requestID as Integer)
- method Constructor
- method RequestAVAssetForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestAVAssetForVideoCompletedMBS, tag as Variant = nil) as Integer
- method RequestExportSessionForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestExportSessionForVideoCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageDataAndOrientationForAsset(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageForAssetSync(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, byref Info as Dictionary) as NSImageMBS
- method RequestLivePhotoForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHLivePhotoRequestOptionsMBS, CompletionHandler as RequestLivePhotoForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestPlayerItemForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, CompletionHandler as RequestPlayerItemForVideoCompletedMBS, tag as Variant = nil) as Integer
- 8 shared methods
- shared method available as boolean
- shared method defaultManager as PHImageManagerMBS
- shared method MaximumSize as CGSizeMBS
- shared method PHImageCancelledKey as String
- shared method PHImageErrorKey as String
- shared method PHImageResultIsDegradedKey as String
- shared method PHImageResultIsInCloudKey as String
- shared method PHImageResultRequestIDKey as String
- 6 delegates
- delegate RequestAVAssetForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, AVAsset as Variant, AVAudioMix as Variant, info as Dictionary, tag as Variant)
- delegate RequestExportSessionForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as string, exportSession as Variant, info as Dictionary, tag as Variant)
- delegate RequestImageDataAndOrientationForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, imageData as MemoryBlock, dataUTI as String, orientation as Integer, info as Dictionary, tag as Variant)
- delegate RequestImageForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, result as NSImageMBS, info as Dictionary, tag as Variant)
- delegate RequestLivePhotoForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, livePhoto as PHLivePhotoMBS, info as Dictionary, tag as Variant)
- delegate RequestPlayerItemForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, playerItem as Variant, info as Dictionary, tag as Variant)
- 4 constants
Constants
Constant | Value | Description |
---|---|---|
PHInvalidImageRequestID | 0 | A special value provided for asynchronous image requests that cannot be canceled. |
Content Modes
Constant | Value | Description |
---|---|---|
ContentModeAspectFill | 1 |
Scales the image so that it completely fills the target size. |
ContentModeAspectFit | 0 |
Scales the image so that its larger dimension fits the target size. |
ContentModeDefault | 0 | Fits the image to the requested size using the default option, PHImageContentModeAspectFit. more |
This class has no sub classes.
The items on this page are in the following plugins: MBS Mac64bit Plugin.
PHAssetResourceRequestOptionsMBS - PHChangeMBS