کلاس GCKUICastButton
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک زیر کلاس از UIButton که دکمه "Cast" را پیاده سازی می کند.
- از آنجایی که
- 3.0
UIButton را به ارث می برد.
|
BOOL | triggersDefaultCastDialog |
| پرچمی که نشان میدهد آیا یک رویداد لمسی روی این دکمه نمایش کادر گفتگوی Cast را که توسط چارچوب ارائه میشود فعال میکند یا خیر. بیشتر...
|
|
- (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: برای همه حالت های پخش اعمال می شود.
- (BOOL) triggersDefaultCastDialog |
|
read write nonatomic assign |
پرچمی که نشان میدهد آیا یک رویداد لمسی روی این دکمه نمایش کادر گفتگوی Cast را که توسط چارچوب ارائه میشود فعال میکند یا خیر.
به طور پیش فرض این ویژگی روی YES
تنظیم شده است. اگر برنامه ای بخواهد خودش رویدادهای لمسی را مدیریت کند، باید ویژگی را روی NO
تنظیم کند و یک هدف و اقدام مناسب برای رویداد لمسی ثبت کند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]