1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【tvOS】UIFocusGuide

Posted at

Screen Shot 2018-03-19 at 14.18.28.png

問題

先端のボタンから、「追加」のボタンへFocusできないこと。

解決

sensei.swift
    @IBOutlet weak var addBtn: UIButton!
    @IBOutlet weak var senseiCollection: UICollectionView!
    private let focusGuide = UIFocusGuide()
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addLayoutGuide(focusGuide)
        
        focusGuide.topAnchor.constraint(equalTo: addBtn.topAnchor).isActive = true
        focusGuide.leftAnchor.constraint(equalTo: senseiCollection.leftAnchor).isActive = true
        
        focusGuide.heightAnchor.constraint(equalTo: addBtn.heightAnchor).isActive = true
        focusGuide.widthAnchor.constraint(equalTo: senseiCollection.widthAnchor).isActive = true
        
        focusGuide.preferredFocusEnvironments = [addBtn]
    }
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?