I created a popover inside my MainViewController when some button touched it using the UIPopoverPresentationController and set how it delegates, as shown at WWDC 2014, as follows:
MainViewController.swift
class MainViewController : UIViewController, UIPopoverPresentationControllerDelegate { @IBAction func showPopover(sender: AnyObject) { var popoverContent = self.storyboard?.instantiateViewControllerWithIdentifier("PopOverViewController") as UIViewController popoverContent.modalPresentationStyle = UIModalPresentationStyle.Popover var popover = popoverContent.popoverPresentationController popoverContent.preferredContentSize = CGSizeMake(250, 419) popover!.delegate = self popover!.sourceView = self.view popover!.sourceRect = CGRectMake(180,85,0,0) self.presentViewController(popoverContent, animated: true, completion: nil) } }
The popover has a View inside it, and when the View it clicked using the Tap Gesture descriptor, I show the LastViewController using the modal segment, the modal segment is created through the Interface Builder, and not in the code, using the action to represent another LastViewController
As soon as the LastViewController deviates and I return to the MainViewController , the popover remains open.
Inside PopOverController , I no longer have the default code.
LastViewController.swift
@IBAction func dismissVIew(sender: AnyObject) { self.dismissViewControllerAnimated(true, completion: nil) }
The above code is used to reject the LastViewController after clicking the button inside.
Storyboard

How can I reject a popover after it is shown by another LastViewController , or before another LastViewController ?
Thanks in advance
ios8 swift uipopovercontroller
Victor sigler
source share