# How to programmatically enable or disable text tracks on iOS

This article describes how you can use the TextTrack API to enable or disable subtitles, closed captions or metadata. Implementing this functionality is a common use-case for developers who want to build their own UI to toggle subtitles.

It is advised to disable the text tracks which you do not want to display, in order to avoid issues with overlapping text.

## Usage

Set the `mode` of a [`TextTrack`](https://optiview.dolby.com/docs/theoplayer/v11/api-reference/ios/Protocols/TextTrack).

```swift
// disable all text tracks
for i in 0..<self.player.textTracks.count {
    self.player.textTracks[i].mode = .disabled
}
// enable a specific text track
self.player.textTracks[indexOfRequestedTextTrack].mode = .showing
```

## Related articles

* [How to dynamically change the visible captions](https://optiview.dolby.com/docs/theoplayer/how-to-guides/ios/text-tracks/change-visible-captions.md)
* [How to programmatically detect text tracks](https://optiview.dolby.com/docs/theoplayer/how-to-guides/ios/text-tracks/detect-text-tracks.md)
* [How to build a chromeless UI](https://optiview.dolby.com/docs/theoplayer/how-to-guides/ios/ui/build-chromeless-ui.md)
