<GCKUIImageCache> Giao thức
Một giao thức xác định phương tiện để truy xuất và lưu hình ảnh vào bộ nhớ đệm.
Phương thức triển khai mặc định được khung sử dụng nội bộ để lưu hình minh hoạ nội dung đa phương tiện hiển thị trong giao diện người dùng vào bộ nhớ đệm. Ứng dụng có thể cung cấp phương thức triển khai tuỳ chỉnh bằng cách đặt thuộc tính GCKCastContext::imageCache.
- Năm thành lập
- 3
Kế thừa <NSObject>.
- (void) fetchImageForURL: |
|
(NSURL *) |
imageURL |
completion: |
|
(void(^)(UIImage *_Nullable)) |
completion |
|
|
| |
Tìm nạp hình ảnh tại URL đã cho và trả về phiên bản hình ảnh được điều chỉnh theo tỷ lệ.
Đây là hoạt động không đồng bộ.
- 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. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2023-12-01 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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"]]