<GCKUIImagePicker> 协议
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
用于从 GCKMediaMetadata 对象中选择给定用途的图片。
框架在内部使用默认实现,它始终从元数据中选择第一个图像以用于所有用途。应用可以通过设置 GCKCastContext::imagePicker 属性来提供自定义实现。
- 辛塞
- 3.0
此类继承 <NSObject>。
从媒体元数据返回指定类型的图片。
- Parameters
-
imageHints | The hints about how to pick the image. |
metadata | The media metadata to pick from. |
- 返回
- 所选图片,如果没有适合请求类型的图片,则为
nil
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-12-06。
[null,null,["最后更新时间 (UTC):2022-12-06。"],[[["\u003cp\u003e\u003ccode\u003eGCKUIImagePicker\u003c/code\u003e is a protocol used for selecting images from \u003ccode\u003eGCKMediaMetadata\u003c/code\u003e for display in the Google Cast user interface.\u003c/p\u003e\n"],["\u003cp\u003eA default implementation selects the first image from the metadata, but applications can provide a custom implementation for more nuanced image selection.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetImageWithHints:fromMetadata:\u003c/code\u003e method is the core functionality, allowing developers to retrieve an image based on specified criteria (hints) from the metadata.\u003c/p\u003e\n"],["\u003cp\u003eBy setting the \u003ccode\u003eGCKCastContext::imagePicker\u003c/code\u003e property, developers can customize how images are selected for their Cast application's UI elements.\u003c/p\u003e\n"]]],["The `GCKUIImagePicker` protocol is used to select an image from `GCKMediaMetadata`. By default, the framework selects the first image. Applications can implement custom selection logic by setting `GCKCastContext::imagePicker`. The core action is the `getImageWithHints:fromMetadata:` method, which takes `GCKUIImageHints` and `GCKMediaMetadata` as parameters to determine the image. The method returns the selected `GCKImage` or `nil` if no suitable image is found.\n"],null,["# <GCKUIImagePicker> Protocol\n\n[Instance Methods](#pub-methods) \n\\\u003cGCKUIImagePicker\\\u003e Protocol Reference \n\nOverview\n--------\n\nAn object used for selecting an image for a given purpose from a [GCKMediaMetadata](/cast/v3/reference/ios/interface_g_c_k_media_metadata \"A container for media metadata. \") object.\n\nA default implementation is used internally by the framework which always selects the first image from the metadata for all uses. The application can provide a custom implementation by setting the [GCKCastContext::imagePicker](/cast/v3/reference/ios/category_g_c_k_cast_context_07_u_i_08#ada8e8d94275d23c230956e5146d19633 \"The image picker implementation that will be used to select an image for a specific purpose...\") property.\n\nSince\n: 3.0\n\nInherits \\\u003cNSObject\\\u003e.\n\n|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| Instance Method Summary ----------------------- ||\n| ([GCKImage](/cast/v3/reference/ios/interface_g_c_k_image) \\*__nullable) | - [getImageWithHints:fromMetadata:](/cast/v3/reference/ios/protocol_g_c_k_u_i_image_picker-p#a371c83c0ff064b94abe27444cbac0663) |\n| | Returns an image of the specified type from the media metadata. [More...](#a371c83c0ff064b94abe27444cbac0663) |\n| ||\n\nMethod Detail\n-------------\n\n|-----------------------------------------------------------------------------------------------|---|--------------------------------------------------------------------------------------|--------------|\n| - ([GCKImage](/cast/v3/reference/ios/interface_g_c_k_image) \\* __nullable) getImageWithHints: | | ([GCKUIImageHints](/cast/v3/reference/ios/interface_g_c_k_u_i_image_hints) \\*) | *imageHints* |\n| fromMetadata: | | (const [GCKMediaMetadata](/cast/v3/reference/ios/interface_g_c_k_media_metadata) \\*) | *metadata* |\n| | | | |\n\nReturns an image of the specified type from the media metadata.\n\nParameters\n:\n\n |------------|----------------------------------------|\n | imageHints | The hints about how to pick the image. |\n | metadata | The media metadata to pick from. |\n\n\nReturns\n: The selected image, or `nil` if there is no appropriate image for the requested type."]]