title: popover from an arbitrary anchor point - Swift
body: <p>I would like to make a popover from a button like this pic:</p>
  
  <p><a href="https://i.stack.imgur.com/ICyta.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ICyta.png" alt="enter image description here"></a></p>
  
  <p>to do this I'm following below steps:</p>
  
  <p>1.I created a view controller(plus a Controller) and I changed size it to 100*200</p>
  
  <p>2.I make a segue from first controller (<code>JobsViewController</code>) to above controller as <code>present as popover</code> and I set a identifier:</p>
  
  <p><a href="https://i.stack.imgur.com/QaNhf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QaNhf.png" alt="enter image description here"></a></p>
  
  <p>3.in <code>JobsViewController</code>:</p>
  
  <pre><code>func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
      if segue.identifier == "showFeatureJobs" {
  
          //let popoverViewController = segue.destination
          // popoverViewController.modalPresentationStyle = UIModalPresentationStyle.popover
          // popoverViewController.popoverPresentationController!.delegate = self
  
          // get a reference to the view controller for the popover
          let popController = UIStoryboard(name: "JobsViewController", bundle: nil).instantiateViewController(withIdentifier: "showFeatureJobs")
  
          // set the presentation style
          popController.modalPresentationStyle = UIModalPresentationStyle.popover
  
          // set up the popover presentation controller
          popController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up
          popController.popoverPresentationController?.delegate = self
          popController.popoverPresentationController?.sourceView = sender as! UIView? // button
          popController.popoverPresentationController?.sourceRect = (sender?.bounds)!
  
          // present the popover
          self.present(popController, animated: true, completion: nil)
  
      }
  }
  
  // MARK: - UIPopoverPresentationControllerDelegate method
  
  func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -&gt; UIModalPresentationStyle {
  
      // Force popover style
      return UIModalPresentationStyle.none
  }
  </code></pre>
  
  <p>4.but when I click on my button, my popover cover all my page:</p>
  
  <p><a href="https://i.stack.imgur.com/bD9Eq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bD9Eq.png" alt="enter image description here"></a></p>
  
  <p>where is my problem?</p>