I am trying to make a popup that will be presented with a click of a button. I tried to follow the instructions that I found on Google, but my pop view, presented in full screen, and its background is black. Here is my code:
class ViewController: UIViewController, UIPopoverPresentationControllerDelegate { @IBAction func someButtonPressed(sender: UIButton) { let storyboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let popupVC = storyboard.instantiateViewControllerWithIdentifier("hello") as! popupViewController popupVC.modalPresentationStyle = .Popover popupVC.preferredContentSize = CGSizeMake(300, 300) let pVC = popupVC.popoverPresentationController pVC?.permittedArrowDirections = .Any pVC?.delegate = self pVC?.sourceView = sender pVC?.sourceRect = CGRect(x: 100, y: 100, width: 1, height: 1) presentViewController(popupVC, animated: true, completion: nil) } }
What am I doing wrong?
source share