# &lt;GCKUIMediaButtonBarProtocol&gt; Protocol

[Instance Methods](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#pub-methods) \<GCKUIMediaButtonBarProtocol\> Protocol Reference

## Overview

The [GCKUIMediaButtonBarProtocol](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p "The GCKUIMediaButtonBarProtocol delegate protocol. ") delegate protocol.

Since
:   3.1

Inherits \<NSObject\>.

Inherited by [GCKUIExpandedMediaControlsViewController](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_expanded_media_controls_view_controller), and [GCKUIMiniMediaControlsViewController](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_u_i_mini_media_controls_view_controller).

|---|---|
| ## Instance Method Summary ||
| (NSUInteger) | - [buttonCount](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a4c2b60c6a3eb060451ba935cd165958b) |
|   | The maximum number of buttons that can be customized by the receiver. [More...](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a4c2b60c6a3eb060451ba935cd165958b) |
|   ||
| (void) | - [setButtonType:atIndex:](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#ae46f0ed12f8b8f80402dd0b14fee05d8) |
|   | Sets the button type for the button at position `index`. [More...](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#ae46f0ed12f8b8f80402dd0b14fee05d8) |
|   ||
| ([GCKUIMediaButtonType](https://developers.google.com/cast/docs/reference/ios/g_c_k_u_i_media_button_bar_protocol_8h#a2d5e2d3080fedfa873e79ab70d7cbc39)) | - [buttonTypeAtIndex:](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a85f8591bd7bfd3202be0b959883b134c) |
|   | Returns the current type of button at a given position. [More...](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a85f8591bd7bfd3202be0b959883b134c) |
|   ||
| (void) | - [setCustomButton:atIndex:](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a90ccc955aae0ce96ffe6f631bb226685) |
|   | Sets the instance of [**UIButton**](https://goo.gl/VK61wU) that should be presented at a given button position. [More...](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a90ccc955aae0ce96ffe6f631bb226685) |
|   ||
| (nullable UIButton \*) | - [customButtonAtIndex:](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a2a7778706da784d230aa2b777fab6a68) |
|   | Returns a reference to the custom button at a given position. [More...](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a2a7778706da784d230aa2b777fab6a68) |
|   ||

## Method Detail

|---|---|---|---|
| - (NSUInteger) buttonCount |   |   |   |

The maximum number of buttons that can be customized by the receiver.

Returns
:   Number of buttons.

|---|---|---|---|
| - (void) setButtonType: |   | ([GCKUIMediaButtonType](https://developers.google.com/cast/docs/reference/ios/g_c_k_u_i_media_button_bar_protocol_8h#a2d5e2d3080fedfa873e79ab70d7cbc39)) | *buttonType* |
| atIndex: |   | (NSUInteger) | *index* |
|   |   |   |   |

Sets the button type for the button at position `index`.

Parameters
:

    |---|---|
    | buttonType | The type of the button. If the type is [GCKUIMediaButtonTypeCustom](https://developers.google.com/cast/docs/reference/ios/g_c_k_u_i_media_button_bar_protocol_8h#a2d5e2d3080fedfa873e79ab70d7cbc39a9512b399e45bf2a2aa2aa259af0b97c4), a [**UIButton**](https://goo.gl/VK61wU) instance should be passed for the same index using [setCustomButton:atIndex:](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a90ccc955aae0ce96ffe6f631bb226685). Otherwise a default button is created and presented in that position. |
    | index | The position in which the button should be presented. 0 is the left-most position. Indices should be smaller than the value returned by [buttonCount](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a4c2b60c6a3eb060451ba935cd165958b). |


|---|---|---|---|---|
| - ([GCKUIMediaButtonType](https://developers.google.com/cast/docs/reference/ios/g_c_k_u_i_media_button_bar_protocol_8h#a2d5e2d3080fedfa873e79ab70d7cbc39)) buttonTypeAtIndex: |   | (NSUInteger) | *index* |   |

Returns the current type of button at a given position.

Parameters
:

    |---|---|
    | index | The button's position, where 0 is the left-most position. |


Returns
:   The type of the button at the selected position.

|---|---|---|---|
| - (void) setCustomButton: |   | (nullable UIButton \*) | *customButton* |
| atIndex: |   | (NSUInteger) | *index* |
|   |   |   |   |

Sets the instance of [**UIButton**](https://goo.gl/VK61wU) that should be presented at a given button position.

Parameters
:

    |---|---|
    | customButton | The button instance to be presented in the control bar. |
    | index | The position in which the button should be presented. 0 is the left-most position. Indices should be smaller than the value returned by [buttonCount](https://developers.google.com/cast/docs/reference/ios/protocol_g_c_k_u_i_media_button_bar_protocol-p#a4c2b60c6a3eb060451ba935cd165958b). |


|---|---|---|---|---|
| - (nullable UIButton \*) customButtonAtIndex: |   | (NSUInteger) | *index* |   |

Returns a reference to the custom button at a given position.

Parameters
:

    |---|---|
    | index | The button's position, where 0 is the right-most position. |


Returns
:   A reference to the button at the selected position, or `nil` if there is no custom button at that position, or the position is invalid.