# GCKUICastButton Class

[Instance Methods](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#pub-methods) \| [Properties](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#properties) GCKUICastButton Class Reference

## Overview

A subclass of [**UIButton**](https://goo.gl/VK61wU) that implements a "Cast" button.

Since
:   3.0

Inherits UIButton.

|---|---|
| ## Instance Method Summary ||
| (instancetype) | - [initWithCoder:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#a23413a39b3e6a8b12834d34c68f74445) |
|   | Constructs a new [GCKUICastButton](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button "A subclass of UIButton that implements a \"Cast\" button. ") using the given decoder. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#a23413a39b3e6a8b12834d34c68f74445) |
|   ||
| (instancetype) | - [initWithFrame:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#a79e5ad64b3c53b6dbc14defda46429d3) |
|   | Constructs a new [GCKUICastButton](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button "A subclass of UIButton that implements a \"Cast\" button. ") with the given frame. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#a79e5ad64b3c53b6dbc14defda46429d3) |
|   ||
| (void) | - [setInactiveIcon:activeIcon:animationIcons:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#aeb7e7925cdbcf8e553dd51bf0abcadc7) |
|   | Sets the icons for the active, inactive, and animated states of the button. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#aeb7e7925cdbcf8e553dd51bf0abcadc7) |
|   ||
| (void) | - [setAccessibilityLabel:forCastState:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#af6cad96ec86d102ad38a0ce3b27669d3) |
|   | Sets the accessibility label for the cast states of the button. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#af6cad96ec86d102ad38a0ce3b27669d3) |
|   ||

|---|---|
| ## Property Summary ||
| BOOL | [triggersDefaultCastDialog](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#aa0f22a89c101e9d6c4b233e72ddf815c) |
|   | 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...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#aa0f22a89c101e9d6c4b233e72ddf815c) |
|   ||
| id\< [GCKUICastButtonDelegate](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_cast_button_delegate-p) \> | [delegate](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#af7173c7b0b7724466b739246f3a9fc4f) |
|   | Set the delegate to respond to the user actions performed on the `https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button`. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button#af7173c7b0b7724466b739246f3a9fc4f) |
|   ||

## Method Detail

|---|---|---|---|---|
| - (instancetype) initWithCoder: |   | (NSCoder \*) | *decoder* |   |

Constructs a new [GCKUICastButton](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button "A subclass of UIButton that implements a \"Cast\" button. ") using the given decoder.

|---|---|---|---|---|
| - (instancetype) initWithFrame: |   | (CGRect) | *frame* |   |

Constructs a new [GCKUICastButton](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button "A subclass of UIButton that implements a \"Cast\" button. ") with the given frame.

|---|---|---|---|
| - (void) setInactiveIcon: |   | (UIImage \*) | *inactiveIcon* |
| activeIcon: |   | (UIImage \*) | *activeIcon* |
| animationIcons: |   | (NSArray\< UIImage \* \> \*) | *animationIcons* |
|   |   |   |   |

Sets the icons for the active, inactive, and animated states of the button.

The 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.

|---|---|---|---|
| - (void) setAccessibilityLabel: |   | (NSString \*) | *label* |
| forCastState: |   | (GCKCastState) | *state* |
|   |   |   |   |

Sets the accessibility label for the cast states of the button.

This is the recommended way to set accessibility label for the button. Label set by setAccessibilityLabel: is applied to all cast states.

## Property Detail

|---|---|
| |---| | - (BOOL) triggersDefaultCastDialog | | readwritenonatomicassign |

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.

By 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. This property cannot be set to NO if `delegate` is set to non-nil value.

**[Deprecated:](https://developers.google.com/cast/docs/reference/ios/deprecated#_deprecated000041)**
:   Use [GCKUICastButtonDelegate](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_cast_button_delegate-p "Use the methods of this protocol to present custom dialog in response to user action. ") methods to respond to user actions on the cast button.

|---|---|
| |---| | - (id\<[GCKUICastButtonDelegate](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_cast_button_delegate-p)\>) delegate | | readwritenonatomicweak |

Set the delegate to respond to the user actions performed on the `https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_cast_button`.

Delegate should not be set to non-nil value if the deprecated property `triggersDefaultCastDialog` is set to NO.

Since
:   4.6.0