<GCKUICastButtonDelegate> 协议
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
使用此协议的方法显示自定义对话框来响应用户操作。
- 开始时间
- 4.6.0
继承 <UIButtonNSObject>。
- (void) castButtonDidTapToPresentLocalNetworkAccessPermissionDialog: |
|
(GCKUICastButton *) |
castButton |
|
|
optional |
告知受托人,在 iOS14 或更高版本上,用户首次点按投射按钮,且投射设备发现未在当前或以前的应用会话中启动。
实现此方法以显示自定义对话框。如果未实现,系统会显示默认对话框。
- Parameters
-
- (void) castButtonDidTap: |
|
(GCKUICastButton *) |
castButton |
toPresentDialogForCastState: |
|
(GCKCastState) |
castState |
|
|
| |
|
optional |
告知委托,在当前或上一个应用会话中发起发现后,用户点按了投射按钮。
实现此方法以根据投射状态显示自定义对话框。观察 GCKCastContext::castState,以根据投射状态的变化动态更新对话框。如果未实现,系统会显示默认对话框。
- Parameters
-
castButton | Instance of GCKUICastButton tapped. |
castState | Cast state when the cast button is tapped. |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThe \u003ccode\u003eGCKUICastButtonDelegate\u003c/code\u003e protocol allows developers to present custom dialogs in response to user interactions with the Cast button.\u003c/p\u003e\n"],["\u003cp\u003eIt provides two optional methods: \u003ccode\u003ecastButtonDidTapToPresentLocalNetworkAccessPermissionDialog:\u003c/code\u003e and \u003ccode\u003ecastButtonDidTap:toPresentDialogForCastState:\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecastButtonDidTapToPresentLocalNetworkAccessPermissionDialog:\u003c/code\u003e is called the first time the Cast button is tapped on iOS 14 or later, before device discovery has begun.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecastButtonDidTap:toPresentDialogForCastState:\u003c/code\u003e is called on subsequent taps of the Cast button, after device discovery has started, allowing for custom dialogs based on the current cast state.\u003c/p\u003e\n"],["\u003cp\u003eIf these methods are not implemented, default dialogs will be presented.\u003c/p\u003e\n"]]],["The `GCKUICastButtonDelegate` protocol allows for custom dialog presentation in response to user interactions with a cast button. It has two key instance methods: `castButtonDidTapToPresentLocalNetworkAccessPermissionDialog:` is triggered when the user taps the cast button for the first time on iOS 14+ without prior device discovery and allows to present a permission dialog. `castButtonDidTap:toPresentDialogForCastState:` is triggered when the user taps the button after device discovery has been initiated, allowing a custom dialog based on the cast state. If neither is implemented, the default dialog is displayed.\n"],null,["# <GCKUICastButtonDelegate> Protocol\n\n[Instance Methods](#pub-methods) \n\\\u003cGCKUICastButtonDelegate\\\u003e Protocol Reference \n\nOverview\n--------\n\nUse the methods of this protocol to present custom dialog in response to user action.\n\nSince\n: 4.6.0\n\nInherits \\\u003cUIButtonNSObject\\\u003e.\n\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Instance Method Summary ----------------------- ||\n| (void) | - [castButtonDidTapToPresentLocalNetworkAccessPermissionDialog:](/cast/docs/reference/ios/protocol_g_c_k_u_i_cast_button_delegate-p#ac6aa5433a7e11672e979ee1d9c1cf800) |\n| | Tells the delegate that the cast button is tapped by the user for the first time on iOS14 or above and cast devices discovery has not started in the current or previous app sessions. [More...](#ac6aa5433a7e11672e979ee1d9c1cf800) |\n| ||\n| (void) | - [castButtonDidTap:toPresentDialogForCastState:](/cast/docs/reference/ios/protocol_g_c_k_u_i_cast_button_delegate-p#ac814e37993fa52f64de3334c92676bd4) |\n| | Tells the delegate that the cast button is tapped by the user after the discovery has been initiated in current or previous app session. [More...](#ac814e37993fa52f64de3334c92676bd4) |\n| ||\n\nMethod Detail\n-------------\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|\n| |-----------------------------------------------------------------------|---|----------------------------------------------------------------------------------|--------------|---| | - (void) castButtonDidTapToPresentLocalNetworkAccessPermissionDialog: | | ([GCKUICastButton](/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button) \\*) | *castButton* | | | optional |\n\nTells the delegate that the cast button is tapped by the user for the first time on iOS14 or above and cast devices discovery has not started in the current or previous app sessions.\n\nImplement this method to present the custom dialog. If not implmemented, the default dialog is presented.\n\nParameters\n:\n\n |------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | castButton | Instance of [GCKUICastButton](/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") tapped. |\n\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|\n| |------------------------------|---|----------------------------------------------------------------------------------|--------------| | - (void) castButtonDidTap: | | ([GCKUICastButton](/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button) \\*) | *castButton* | | toPresentDialogForCastState: | | (GCKCastState) | *castState* | | | | | | | optional |\n\nTells the delegate that the cast button is tapped by the user after the discovery has been initiated in current or previous app session.\n\nImplement this method to present the custom dialog as per the cast state. Observe [GCKCastContext::castState](/cast/docs/reference/ios/interface_g_c_k_cast_context#a41a8b6a12d778a4ea763b0b7d1141c54 \"The current casting state for the application. \") to update the dialog dynamically as per changes in the cast state. If not implmemented, the default dialog is presented.\n\nParameters\n:\n\n |------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | castButton | Instance of [GCKUICastButton](/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") tapped. |\n | castState | Cast state when the cast button is tapped. |"]]