Using Xcode 7.2.1
, I have set up some textFields
. Certain times when I'm in the view controller, all subviews
disappear from self.view when tapping a textField
.
All constraints are satisfied, and I've even tried pinning them in numerous satisfying combinations with the same result.
When I look in the view debugger after this happens, all subviews
of self.view
are nowhere to be found.
I am very confused as to why this is happening.
The problem had to deal with when I was calling popToRootViewController() in my logout viewcontroller that was presenting the (problematic) view controller.
All views disappeared in the view controller being segued to when popping before the segue:
@IBAction func onLogoutTapped(sender: AnyObject) {
backendless.userService.logout({ (object) -> Void in
self.navigationController?.popToRootViewControllerAnimated(false)
self.performSegueWithIdentifier("profileToLoginSegue", sender: self)
}) { (fault) -> Void in
print("Server reported an error: \(fault)")
}
}
However, when I called popToRootViewController() within the closure, the modally presented (and previously problematic) view controller acted normally:
@IBAction func onLogoutTapped(sender: AnyObject) {
backendless.userService.logout({ (object) -> Void in
self.performSegueWithIdentifier("profileToLoginSegue", sender: self)
self.navigationController?.popToRootViewControllerAnimated(true)
}) { (fault) -> Void in
print("Server reported an error: \(fault)")
}
}
I am not exactly sure why this is, but it was definitely the problem.