title: Popover presentation on an iPhone using UIPopoverPresentationController
body: <p>Hello everyone I want to make a popover for iPhone so here is my code where I am geting wrong please suggest I want to create somthing like below pic but mine is covering the whole screen and I dont want to use segue .So basicaly I want if I click on button a resized View controller should popup how can I achieve this please help.I had followed this tutorial.
  <a href="https://www.youtube.com/watch?v=UQBbJQNEDA4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=UQBbJQNEDA4</a> 
  <a href="https://i.stack.imgur.com/qmAq7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qmAq7.png" alt="enter image description here"></a></p>
  
  <pre><code>#import "ViewController.h"
  #import "Popup.h"
  
  @interface ViewController ()&lt;UIPopoverPresentationControllerDelegate&gt;
  {
      Popup * popupController;
      UIPopoverPresentationController *popupPresentationController;
  }
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  
  
  }
  
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)popupOnClick:(id)sender {
  
      popupController=[self.storyboard instantiateViewControllerWithIdentifier:@"Popup"];
      popupController.modalPresentationStyle=UIModalPresentationPopover;
      popupPresentationController= [popupController popoverPresentationController];
      popupPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
      popupController.preferredContentSize=CGSizeMake(150, 300);
      popupPresentationController.delegate = self;
  
      [self presentViewController:popupController animated:YES completion:NULL];
  
  
      // in case we don't have a bar button as reference
      popupPresentationController.sourceView = _popupButton;
      popupPresentationController.sourceRect = _popupButton.frame;
  }
  - (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection {
      return UIModalPresentationNone;
  }
  
  @end
  </code></pre>