简体   繁体   中英

After segue using Storyboard ID UINavigationController disappears

In my app where I use Parse.com framework, afer any operation for example sign up I would like to go to another sotyboard for example login , so I do this code:

user.signUpInBackgroundWithBlock({ (succeeded: Bool, error: NSError?) -> Void in

            if error != nil{
                // alert Error

            } else {

                let action = UIAlertController(title: "Congratulattion!", message: "Now yu can start chatting", preferredStyle: .Alert)
                let ok = UIAlertAction(title: "OK", style: .Default, handler: { (alert) -> Void in

                let mainVC = self.storyboard?.instantiateViewControllerWithIdentifier("login") as! LogInViewController
                self.presentViewController(mainVC, animated: true, completion: nil)

                })
                action.addAction(ok)
                self.presentViewController(action, animated: true, completion: nil)

            }

afert this segue my NavgationBar disappears. My Application looks like that:

我的整个sotryboard

导航后导航栏消失

Navbar在我注册应用之前存在

What Do I need to do, my Navbar doesn't disappear?

Picture with error which I see after segue from Sign Up App Chat to Welcome in Chat App using self.performSegueWithIdentifier("signup", sender: self)

segue1

segue2

I don't think you want to use the code self.storyboard?.instantiateViewControllerWithIdentifier("login") as! LogInViewController self.storyboard?.instantiateViewControllerWithIdentifier("login") as! LogInViewController . It looks like you are going from your signup controller to the login controller in your code, so you might want to add a segue connecting those 2 in your storyboard, and if you make it a segue of type 'show', then the navigation bar will stay intact. Then you can call performSegue on this segue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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