title: Diagonal focussing in tvOS using UIFocusGuide
body: <p>I have 4 <code>UIButtons</code> in my view:</p>
  
  <p><a href="https://i.stack.imgur.com/3gNmM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3gNmM.png" alt="enter image description here"></a></p>
  
  <p>All four are <code>UIButtons</code> with two <code>UIButtons</code> on the left side and another two on the right side. Focus is going from the top button to the bottom button when I select down arrow. I want focus to navigate through all four buttons from top to bottom and again from bottom to top when I press the down arrow and up arrow. 
  I also want to change the background color of the <code>UIBUtton</code> when it is highlighted(Currently white is coming by default).</p>
  
  <p>I tried below code to navigate the focus but I couldn't get what I wanted.</p>
  
  <pre><code>let focusGuide = UIFocusGuide()
  view.addLayoutGuide(focusGuide!) 
  focusGuide!.rightAnchor.constraintEqualToAnchor(self.btnPlay.rightAnchor).active = true
  focusGuide!.topAnchor.constraintEqualToAnchor(self.switchFirst.topAnchor).active = true
  focusGuide!.widthAnchor.constraintEqualToAnchor(self.btnPlay.widthAnchor).active = true
  focusGuide!.heightAnchor.constraintEqualToAnchor(self.switchFirst.heightAnchor).active = true
  focusGuide!.preferredFocusedView = self.switchFirst
  </code></pre>
  
  <p>in viewdidLoad and</p>
  
  <p>Below code in  didUpdateFocusInContext</p>
  
  <pre><code>    guard let nextFocusedView = context.nextFocusedView else { return }
  
      switch nextFocusedView {
      case self.switchFirst:
          self.focusGuide!.preferredFocusedView = self.btnPlay
  
      case self.btnPlay:
          self.focusGuide!.preferredFocusedView = self.switchFirst
  
      case self.switchAudioType:
          self.focusGuide!.preferredFocusedView = self.btnAdd
  
      case self.btnAddToWishList:
          self.focusGuide!.preferredFocusedView = self.switchSecond
  </code></pre>