title: How do I hide UI elements on a tap of the View, using swift?
body: <p>Just as <code>navigationController?.hidesBarsOnTap = true</code> hides the navigation bar, how do I hide regular UI elements like buttons, labels etc. with a tap of the view? I made a PDF viewer from scratch and now I need a method that will hide the UI elements on the view with a tap, just like the Photos app does on an iPhone. </p>
  
  <p>Here is the code I attempted to use, but no success:</p>
  
  <pre><code>override func viewDidAppear(animated: Bool) {
          var dismissTap = UITapGestureRecognizer(target: self, action: Selector("dismissViewElements:"))
  
          self.view.addGestureRecognizer(dismissTap)
  
      }
  
      func dismissViewElements(gesture: UITapGestureRecognizer){
          if gesture.state == UIGestureRecognizerState.Began {
              self.backButton.alpha = 0
          }
      }
  </code></pre>
  
  <p>Any suggestions would be very helpful.</p>