简体   繁体   English

我不理解的多视图控制器和segue导航错误消息

[英]Multi view controller and segue navigation error message I don't understand

XCode 7.3, ObjC single view project. XCode 7.3,ObjC单视图项目。 iOS Simulator. iOS模拟器。

I'm in a UIViewController called "LoginViewController". 我在一个名为“ LoginViewController”的UIViewController中。 I click a button, it calls a method called Login. 我单击一个按钮,它调用一种称为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: 在performSegueWithIdentifier方法中,我使用if语句选择该“登录”条件,并在存根此早期阶段执行以下操作:

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: MainMenuViewController可以很好地加载,并且我的数据在UI中可见,但是在完成prepareForSegue方法之后,控制台将其吐出:

UIView: 0x7fc19beaaf60; UIView:0x7fc19beaaf60; frame = (0 0; 320 568); 框架=(0 0; 320568); autoresize = W+H; 自动调整大小= W + H; layer = CALayer: 0x7fc19beab0d0's window is not equal to MainMenuViewController: 0x7fc19bd2d300>'s view's window! layer = CALayer:0x7fc19beab0d0的窗口不等于MainMenuViewController:0x7fc19bd2d300>视图的窗口!

Any ideas? 有任何想法吗?

Thanks! 谢谢!

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 请参阅解决问题的以下解决方案: 在Interface Builder中定义“通用” segue

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM