<GCKUIImageCache> โปรโตคอล
โปรโตคอลที่กำหนดวิธีการเรียกและแคชรูปภาพ
เฟรมเวิร์กจะใช้การติดตั้งใช้งานเริ่มต้นเป็นการภายในเพื่อแคชอาร์ตเวิร์กของสื่อที่แสดงในอินเทอร์เฟซผู้ใช้ แอปพลิเคชันมีการติดตั้งใช้งานที่กําหนดเองได้โดยการตั้งค่าพร็อพเพอร์ตี้ GCKCastContext::imageCache
- Since
- 3.0
รับค่า <NSObject>
- (void) fetchImageForURL: |
|
(NSURL *) |
imageURL |
completion: |
|
(void(^)(UIImage *_Nullable)) |
completion |
|
|
| |
ดึงข้อมูลรูปภาพใน URL ที่ระบุ และแสดงรูปภาพเวอร์ชันการปรับขนาด
ซึ่งเป็นการดำเนินการแบบอะซิงโครนัส
- 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. |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2023-12-01 UTC
[null,null,["อัปเดตล่าสุด 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"]]