Question

I'm dealing with an application with two UIViewControllers. When the application launches, the LoaderViewController is triggered. On that view controller, I am setting up the application for launch and then trying to move into ViewController. The problem is that the prepareForSegue method is called correctly, but it does nothing. I'm trying to do the navigation same way as i've done before. What is it i might be missing here? I'm still very new in iOS development.

 class LoaderViewController: UIViewController {
 @IBOutlet weak var applicationLoadingIndicator: UIActivityIndicatorView!

  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  }

  override func viewDidLoad() {
      super.viewDidLoad()


      applicationLoadingIndicator.startAnimating()
      self.performSegueWithIdentifier("ToMenuViewController", sender: self)
  }

  override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
      var vc: ViewController = segue.destinationViewController as ViewController
  }
}

Here is the image of the storyboard: enter image description here

EDIT - SOLUTION:

Solution was to change the performSegueWithIdentifier call into viewDidAppear() method.

Was it helpful?

Solution

You should not be segueing in viewDidLoad as that is way too soon. At the very least, you should instead segue in viewDidAppear.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top