Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use preferredFocusEnvironments insted of preferredFocusedView for ios 10?

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?

like image 613
vikas prajapati Avatar asked Nov 18 '16 04:11

vikas prajapati


1 Answers

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
}
like image 161
vikas prajapati Avatar answered Sep 19 '22 20:09

vikas prajapati