how to use preferredFocusEnvironments insted of preferredFocusedView for ios 10?
Asked Answered
M

1

5

I am working on apple tv os application. I want to move focus on particular UiButton but I don't know how to use preferredFocusEnvironments instead of preferredFocusedView ?

I am able to use preferredFocusedView but for this variable is deprecated.

so anyone can help me for this issue?

Mcmahon answered 18/11, 2016 at 4:3 Comment(2)
Check this answer please #39479680Windcheater
thanks Roman Podymov.Mcmahon
M
9

I am able to solve this question by following this link

What i did is as below :

@IBOutlet weak var viewTemp: UIView!
override var preferredFocusEnvironments : [UIFocusEnvironment] {
    //Condition
    return [viewTemp]
}

insted of this.

override weak var preferredFocusedView: UIView? {
    //Condition
    return viewTemp
}
Mcmahon answered 21/11, 2016 at 4:22 Comment(1)
This is good way, whenever you find solution you suggest your aswerPismire

© 2022 - 2024 — McMap. All rights reserved.