Skip to content

Instantly share code, notes, and snippets.

@xxllexx
Created November 3, 2017 12:28
Show Gist options
  • Select an option

  • Save xxllexx/4b6f41b13f9f99a4761740a272efa1b5 to your computer and use it in GitHub Desktop.

Select an option

Save xxllexx/4b6f41b13f9f99a4761740a272efa1b5 to your computer and use it in GitHub Desktop.

Revisions

  1. xxllexx created this gist Nov 3, 2017.
    23 changes: 23 additions & 0 deletions preferredFocusEnvironments.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    import UIKit

    class ViewController: UIViewController {
    var isFirst = true
    override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
    }

    override var preferredFocusEnvironments: [UIFocusEnvironment] {
    if isFirst {
    isFirst = false
    return childViewControllers.last!.preferredFocusEnvironments
    } else {
    return super.preferredFocusEnvironments
    }
    }
    }