Mike
Mike

Reputation: 3276

Changing Storyboard in swift

I am trying to switch from Main.storyboard to Main2.storyboard. Main.storyboard is connected to ViewController.swift and Main2.storyboard is connected to Main2.swift

In ViewController.swift I have a button to switch to Main2.stoaryboard

@IBAction func btnSwitchStoryboard(sender: AnyObject) {
        let viewController = UIStoryboard(name: "Main2", bundle: nil).instantiateViewControllerWithIdentifier("Main2")

        self.presentViewController(viewController, animated: true, completion: nil)
    }

The problem is: When I press the button, the Main2.storyboard comes up from the button and goes down after one second, that I am back on Main.storyboard.

How is it possible to stay at Main2.storyboard?

I am developing on iOS 9.2 / xCode 7.2.1 / Swift

Upvotes: 1

Views: 1388

Answers (1)

Mike
Mike

Reputation: 3276

MY SOLUTION: I used to dismiss self.dismissViewControllerAnimated instead of alert.dismissViewControllerAnimated to dismiss an let alert

Upvotes: 1

Related Questions