my project is in swift 2 and works in both orientation.
i have a UISplitViewController presented modally.
in the navigation bar of master view i have a bar button for dismiss this.
when i open the controller in landscape mode the close button work well because master view is always visibile and his parent and presenting view controller are ok.
the problem is in the portrait orientation because master view isn't always visible and his parent and presenting controller are null when i tap the cancel button.
there is a solution?
thanks in advance
presenting controller
i present a modal splitViewController from storyboard:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "splitSegue" {
let split = segue.destinationViewController as! UISplitViewController
let masterNav = split.viewControllers[0] as! UINavigationController
let master = masterNav.topViewController as! MasterController
master.delegate = self
}}
and this is the delegate fun for dismiss:
func updateAppCategory(master: MasterController) {
self.presentedViewController?.dismissViewControllerAnimated(true, completion: nil)
}