I have a storyboard with a Navigation Controller hooked to 2 views, first one containing a UIScrollView which I have populated with several ViewController's (ex Home, Profile, etc), and a second one containing a login screen
I want to be able to logout from one of the subviews/childs of the UIScrollView, one way I've tried is
Simplified code snippet:
ContainerViewController
ViewdidLoad()
{
self.addChildViewController(BVc);
}
ChildViewController containing a logout button
ChildViewController
@IBAction func Loggout(sender: AnyObject)
{
performSegueWithIdentifier("goto_login", sender: parent?)
}
I hope I made myself clear, as It's my first post.
So, what you want to do is move back to earlier View Controller, am I right? If that's correct, you should access the View Controller's navigationController property. For example, if you want to go back in the navigation stack, you could pop the top view:
navigationController?.popViewControllerAnimated(true)
For more information, please take a look at UINavigationController Class Reference: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationController_Class/