jbehrens94
jbehrens94

Reputation: 2406

tvOS navigating through ui elements

I am developing for tvOS at the moment and I have added a UISegmentedControl, this gets focused automatically by the tvOS focus engine. When I added a UIButton, this became the first focused item.

How I do go about setting the first focused item and being able to navigate between them?

Upvotes: 1

Views: 276

Answers (1)

Dave Wood
Dave Wood

Reputation: 13333

Add a read only preferredFocusedView property to your view controller that returns the view you would like to start focused:

override weak var preferredFocusedView: UIView? {
    get {
        return segmentedControl
    }
}

Upvotes: 2

Related Questions