【tvOS】UIFocusGuide
問題
先端のボタンから、「追加」のボタンへ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]
}
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]
}
Author And Source
この問題について(【tvOS】UIFocusGuide), 我々は、より多くの情報をここで見つけました https://qiita.com/pxdang/items/5b4247ae5689f697a451著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .