Reputation: 5000
XCode 7.3, ObjC single view project. iOS Simulator.
I'm in a UIViewController called "LoginViewController". I click a button, it calls a method called Login. In Login I call
[self performSegueWithIdentifier: @"Login" sender:sender];
In the performSegueWithIdentifier method I use an if statement to select on that "Login" condition and at this early stage of stubbing this out do this:
if ([[segue identifier] isEqualToString:@"Login"]) {
MainMenuViewController *mmvc = segue.destinationViewController;
mmvc.strUsername = self.txtUsername.text;
mmvc.strPassword = self.txtPassword.text;
}
The MainMenuViewController loads fine and my data is visible in the UI but right after it completes the prepareForSegue method the console spits this out:
UIView: 0x7fc19beaaf60; frame = (0 0; 320 568); autoresize = W+H; layer = CALayer: 0x7fc19beab0d0's window is not equal to MainMenuViewController: 0x7fc19bd2d300>'s view's window!
Any ideas?
Thanks!
Upvotes: 0
Views: 390
Reputation: 5000
The trick is to create the segue between the view controller's view and the next view controller rather than between a button and the next view controller. See this solution that solved the problem: Defining a "generic" segue in Interface Builder
Upvotes: 1