<GCKUIImageCache> پروتکل
پروتکلی که ابزاری برای بازیابی و ذخیره تصاویر را تعریف می کند.
یک پیاده سازی پیش فرض به صورت داخلی توسط چارچوب برای ذخیره آثار هنری رسانه ای که در رابط کاربری نمایش داده می شود استفاده می شود. برنامه می تواند با تنظیم ویژگی GCKCastContext::imageCache یک پیاده سازی سفارشی ارائه دهد.
- از آنجا که
- 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. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-10-30 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2024-10-30 بهوقت ساعت هماهنگ جهانی."],[[["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"]]