# GCKUICastButton Class

[Instance Methods](https://developers.google.com/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#pub-methods) \| [Properties](https://developers.google.com/cast/v3/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/v3/reference/ios/interface_g_c_k_u_i_cast_button#a23413a39b3e6a8b12834d34c68f74445) |
|   | Constructs a new [GCKUICastButton](https://developers.google.com/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...](https://developers.google.com/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#a23413a39b3e6a8b12834d34c68f74445) |
|   ||
| (instancetype) | - [initWithFrame:](https://developers.google.com/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#a79e5ad64b3c53b6dbc14defda46429d3) |
|   | Constructs a new [GCKUICastButton](https://developers.google.com/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...](https://developers.google.com/cast/v3/reference/ios/interface_g_c_k_u_i_cast_button#a79e5ad64b3c53b6dbc14defda46429d3) |
|   ||
| (void) | - [setInactiveIcon:activeIcon:animationIcons:](https://developers.google.com/cast/v3/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/v3/reference/ios/interface_g_c_k_u_i_cast_button#aeb7e7925cdbcf8e553dd51bf0abcadc7) |
|   ||
| (void) | - [setAccessibilityLabel:forCastState:](https://developers.google.com/cast/v3/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/v3/reference/ios/interface_g_c_k_u_i_cast_button#af6cad96ec86d102ad38a0ce3b27669d3) |
|   ||

|---|---|
| ## Property Summary ||
| BOOL | [triggersDefaultCastDialog](https://developers.google.com/cast/v3/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/v3/reference/ios/interface_g_c_k_u_i_cast_button#aa0f22a89c101e9d6c4b233e72ddf815c) |
|   ||

## Method Detail

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

Constructs a new [GCKUICastButton](https://developers.google.com/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.

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

Constructs a new [GCKUICastButton](https://developers.google.com/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.

|---|---|---|---|
| - (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](https://developers.google.com/cast/v3/reference/ios/g_c_k_common_8h#af0c098ac6b7bff89f13f0bad7b88a5b5)) | *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.