<GCKUIImageCache> Protokoll
Protokoll, das eine Methode zum Abrufen und Speichern von Bildern definiert.
Eine Standardimplementierung wird vom Framework intern verwendet, um Media-Artwork zu speichern, die auf der Benutzeroberfläche angezeigt werden. Die Anwendung kann durch Festlegen der Eigenschaft GCKCastContext::imageCache eine benutzerdefinierte Implementierung bereitstellen.
- Seit
- 3,0
Übernimmt <NSObject>.
- (void) fetchImageForURL: |
|
(NSURL *) |
imageURL |
completion: |
|
(void(^)(UIImage *_Nullable)) |
completion |
|
|
| |
Ruft das Bild unter der angegebenen URL ab und gibt eine skalierte Version des Bildes zurück.
Dies ist ein asynchroner Vorgang.
- Parameters
-
imageURL | The URL of the image. |
completion | A block to invoke once the image has been retrieved. The image should be passed to the block. If there was an error retrieving the image, nil should be passed instead. The block should only be invoked on the main thread. |
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2023-12-01 (UTC).
[null,null,["Zuletzt aktualisiert: 2023-12-01 (UTC)."],[[["The `GCKUIImageCache` protocol defines how images are retrieved and cached for display within the Google Cast framework."],["Developers can customize image caching by providing their own implementation and setting it on the `GCKCastContext`."],["The `fetchImageForURL:completion:` method retrieves and scales images asynchronously, notifying the caller via a completion block on the main thread."]]],["The `GCKUIImageCache` protocol defines image retrieval and caching. It utilizes a default implementation for media artwork displayed in the user interface, but applications can provide custom implementations via `GCKCastContext::imageCache`. The core functionality is provided by the `fetchImageForURL:completion:` method, which asynchronously fetches an image from a given URL. It then returns a scaled version of the image to the main thread through a completion block, or `nil` if an error occurs.\n"]]