I have created a popover in iphone view with a button inside to segue to another ViewController. But all Viewcontroller after popOver have the navigationbar not anymore.
My project structure:
- NavigationController -> ViewController1 -> ViewController2(popOver) ->ViewController3
All connections are: "show",except from ViewController1 to ViewController2: "present as popover" If i connect(show) directly from ViewController1->ViewController3, everything is fine...
Where can be the problem?
I used this tutorial: http://richardallen.me/2014/11/28/popovers.html
ViewController1:
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "PopOverIdentifier" {
let popoverViewController = segue.destinationViewController as!
popoverViewController.modalPresentationStyle = UIModalPresentationStyle.ViewController2
popoverViewController.popoverPresentationController!.delegate = self
}
}
ViewController2 includes Pickerview and:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "toVC3" {
var DestViewController : ViewController3 = segue.destinationViewController as!ViewController3
DestViewController.passedUserID_target = selected_user
}
}
Problem:
I solved this problem (temporarily) with adding a new NavigationController to the ViewController3 with (Editor->EmbedIn->NavigationController) and add a back button to buttom of the layout.
The problem to segue data from VC1->VC3, i solved with defining a global Variable in VC3 and add a action Button (in VC2) with assigning the data to these created global variables.