מחלקה GCKUICastbutton
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
תת-מחלקה של UIButton שמטמיעה לחצן Cast.
- מאז
- 3.0
יורש מ-UIButton.
- (instancetype) initWithCoder: |
|
(NSCoder *) |
decoder |
|
- (instancetype) initWithFrame: |
|
(CGRect) |
frame |
|
- (void) setInactiveIcon: |
|
(UIImage *) |
inactiveIcon |
activeIcon: |
|
(UIImage *) |
activeIcon |
animationIcons: |
|
(NSArray< UIImage * > *) |
animationIcons |
|
|
| |
מגדיר את הסמלים למצבים הפעיל, הלא פעיל והמונפש של הלחצן.
כל התמונות שאתם שולחים צריכות להיות בצבע אחד עם רקע שקוף. צבע התמונות לא משמעותי, כי צבע הגוון של הלחצן (מאפיין tintColor
) קובע את הצבע שבו הן מוצגות.
- (void) setAccessibilityLabel: |
|
(NSString *) |
label |
forCastState: |
|
(GCKCastState) |
state |
|
|
| |
מגדיר את תווית הנגישות למצבי ההפעלה של הכפתור.
זו הדרך המומלצת להגדיר תווית נגישות ללחצן. התווית שמוגדרת על ידי setAccessibilityLabel: מוחלת על כל מצבי ההפעלה של Cast.
- (BOOL) triggersDefaultCastDialog |
|
readwritenonatomicassign |
דגל שמציין אם אירוע מגע בלחצן הזה יפעיל את הצגת תיבת הדו-שיח של Cast שסופקה על ידי המסגרת.
כברירת מחדל, הנכס הזה מוגדר ל-YES
. אם אפליקציה רוצה לטפל בעצמה באירועי מגע, היא צריכה להגדיר את המאפיין לערך NO
ולרשום יעד ופעולה מתאימים לאירוע המגע.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eGCKUICastButton\u003c/code\u003e is a subclass of \u003ccode\u003eUIButton\u003c/code\u003e that provides a pre-built "Cast" button for iOS applications.\u003c/p\u003e\n"],["\u003cp\u003eIt offers customization options for icons representing active, inactive, and animated states, ensuring visual alignment with the app's design.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can manage the button's accessibility labels to enhance usability for users with disabilities.\u003c/p\u003e\n"],["\u003cp\u003eWhile it defaults to triggering the Cast dialog, this behavior can be overridden to allow custom touch event handling within the application.\u003c/p\u003e\n"],["\u003cp\u003eThis class simplifies Cast integration by providing a ready-made UI element and handling the display of the standard Cast dialog.\u003c/p\u003e\n"]]],[],null,["# GCKUICastButton Class\n\n[Instance Methods](#pub-methods) \\| [Properties](#properties) \nGCKUICastButton Class Reference \n\nOverview\n--------\n\nA subclass of [**UIButton**](https://goo.gl/VK61wU) that implements a \"Cast\" button.\n\nSince\n: 3.0\n\nInherits UIButton.\n\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Instance Method Summary ----------------------- ||\n| (instancetype) | - [initWithCoder:](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#a23413a39b3e6a8b12834d34c68f74445) |\n| | Constructs a new [GCKUICastButton](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") using the given decoder. [More...](#a23413a39b3e6a8b12834d34c68f74445) |\n| ||\n| (instancetype) | - [initWithFrame:](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#a79e5ad64b3c53b6dbc14defda46429d3) |\n| | Constructs a new [GCKUICastButton](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") with the given frame. [More...](#a79e5ad64b3c53b6dbc14defda46429d3) |\n| ||\n| (void) | - [setInactiveIcon:activeIcon:animationIcons:](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#aeb7e7925cdbcf8e553dd51bf0abcadc7) |\n| | Sets the icons for the active, inactive, and animated states of the button. [More...](#aeb7e7925cdbcf8e553dd51bf0abcadc7) |\n| ||\n| (void) | - [setAccessibilityLabel:forCastState:](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#af6cad96ec86d102ad38a0ce3b27669d3) |\n| | Sets the accessibility label for the cast states of the button. [More...](#af6cad96ec86d102ad38a0ce3b27669d3) |\n| ||\n\n|------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Property Summary ---------------- ||\n| BOOL | [triggersDefaultCastDialog](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#aa0f22a89c101e9d6c4b233e72ddf815c) |\n| | A flag that indicates whether a touch event on this button will trigger the display of the Cast dialog that is provided by the framework. [More...](#aa0f22a89c101e9d6c4b233e72ddf815c) |\n| ||\n\nMethod Detail\n-------------\n\n|---------------------------------|---|--------------|-----------|---|\n| - (instancetype) initWithCoder: | | (NSCoder \\*) | *decoder* | |\n\nConstructs a new [GCKUICastButton](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") using the given decoder. \n\n|---------------------------------|---|----------|---------|---|\n| - (instancetype) initWithFrame: | | (CGRect) | *frame* | |\n\nConstructs a new [GCKUICastButton](/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button \"A subclass of UIButton that implements a \\\"Cast\\\" button. \") with the given frame. \n\n|---------------------------|---|------------------------------|------------------|\n| - (void) setInactiveIcon: | | (UIImage \\*) | *inactiveIcon* |\n| activeIcon: | | (UIImage \\*) | *activeIcon* |\n| animationIcons: | | (NSArray\\\u003c UIImage \\* \\\u003e \\*) | *animationIcons* |\n| | | | |\n\nSets the icons for the active, inactive, and animated states of the button.\n\nThe supplied images should all be single-color with a transparent background. The color of the images is not significant, as the button's tint color (`tintColor` property) determines the color that they are rendered in. \n\n|---------------------------------|---|--------------------------------------------------------------------------------------------|---------|\n| - (void) setAccessibilityLabel: | | (NSString \\*) | *label* |\n| forCastState: | | ([GCKCastState](/cast/v3/reference/ios/g_c_k_common_8h#af0c098ac6b7bff89f13f0bad7b88a5b5)) | *state* |\n| | | | |\n\nSets the accessibility label for the cast states of the button.\n\nThis is the recommended way to set accessibility label for the button. Label set by setAccessibilityLabel: is applied to all cast states.\n\nProperty Detail\n---------------\n\n|-------------------------------------------------------------------------------|--------------------------|\n| |------------------------------------| | - (BOOL) triggersDefaultCastDialog | | readwritenonatomicassign |\n\nA flag that indicates whether a touch event on this button will trigger the display of the Cast dialog that is provided by the framework.\n\nBy default this property is set to `YES`. If an application wishes to handle touch events itself, it should set the property to `NO` and register an appropriate target and action for the touch event."]]