简体   繁体   English

快速导航和多视图

[英]swift navigation and multiple views

I'm trying to see if this even correct. 我试图看看这是否正确。 But I have multiple views tied to a single navigation controller 但是我有多个视图绑定到一个导航控制器

在此处输入图片说明

Ive given an id to the seque from the listing to the navigation controller mainSeque and from the navigation controller to the login loginViewSeque 我已经为列表提供了ID,从列表到导航控制器mainSeque,从导航控制器到登录loginViewSeque

But when I try to go to the login view when inside viewDidLoad() using the code: 但是,当我尝试使用代码在viewDidLoad()内部进入登录视图时:

self.performSegueWithIdentifier("LoginViewSegue", sender: self)

the app crashes. 该应用程序崩溃。 So it would seem that its weird either incorrectly or called incorrectly. 因此,看起来它要么很奇怪,要么叫错了。

I'm assuming on navigation controller can have multiple views? 我假设导航控制器上可以有多个视图? In this case the login and config view. 在这种情况下,登录和配置视图。 Or does each view require its own navigation controller? 还是每个视图都需要自己的导航控制器?

Okay there are some severe mistakes in your program. 好的,您的程序中存在一些严重错误。 Now you have made instances of 2 Navigation Controller, where you actually require only 1. Remove the one after the tableViewController and create a segue from tableViewController to your loginViewController . 现在,您已经创建了2个Navigation Controller的实例,实际上只需要1个。删除tableViewController之后的实例,并创建一个从tableViewControllerloginViewController Most probably you would wanna make the segue call when the user presses the 'LOCK' button on the top bar. 当用户按下顶部栏上的“ LOCK”按钮时,您最有可能想要进行segue呼叫。 So just hold control and drag from the lock to loginViewController .And you could provide another UIButton to access the configViewController on your tableViewController to segue in the similar manner.That should work for you. 因此,只需按住控件并将其从锁中拖动到loginViewController 。您可以提供另一个UIButton来访问tableViewController上的configViewController以类似的方式进行查找。

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

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