I dragged a ViewController onto my storyboard, segued to it with a popover segue, and setup the size and style in the presentingVC's prepareForSegue. My question is, if my popover has several buttons, where should their code be executed?
" And you get hold of the the content controller by using the popoverPresentationController.presentedViewController method in the UIPopoverPresentationController
What would be ideal for me, since the code I want will change some presentingVC variables, would be delegate back to the presenting VC.
Ultimately just went with delegation in the competition block of the dismiss popover call:
class NavigationViewController: UIViewController {
var presentingVC_Delegate: mainLists_PopoverDelegation!
var whatToDo = "Placeholder"
@IBOutlet var shareBtn: UIButton!
@IBOutlet var clearBtn: UIButton!
@IBOutlet var settingsBtn: UIButton!
//***** ----- ***** ------ ***** ----- ***** ----- *****
//Menu Button Functions
//***** ----- ***** ------ ***** ----- ***** ----- *****
@IBAction func shareBtn_Pressed(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: { finished in
self.presentingVC_Delegate.call_ActivityVC()
})
}
@IBAction func clearBtn_Pressed(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: { finished in
self.presentingVC_Delegate.deleteList()
})
}
@IBAction func settingsBtn_Pressed(sender: AnyObject) {
self.dismissViewControllerAnimated(true, completion: { finished in
self.presentingVC_Delegate.presentSettingsVC()
})
}
}
protocol mainLists_PopoverDelegation {
func call_ActivityVC ()
func deleteList ()
func presentSettingsVC ()
}
With those three functions located in the main VC.