Software-adjustable view controllers without a Swift navigation controller

I want to switch to the new view controller when I click the button without using the navigation controller, and I seem to be unable to do this. I searched everywhere for the answer, but everything I found, either in objective-c, or using the navigation controller, or does not work at all.

func gunsoutButtonPressed(sender:UIButton!) {
    print("yay\t")
    //let encounterVC:AnyObject! = self.storyboard?.instantiateViewControllerWithIdentifier("ecounterViewController")
    //self.showViewController(encounterVC as UIViewController, sender: encounterVC)
    let encounterViewController = self.storyboard.instantiateViewControllerWithIdentifier("encounterViewController") as encounterViewController
    self.pushViewController(encounterViewController, animated: true)
}
+4
source share
2 answers

ViewControllers, . segue, , segue ( IBAction - ). , , .

performSegueWithIdentifier("mySegue", sender: nil)

.

, :)

+8

push- UINavigationController. , :

self.presentViewController(encounterViewController, animated: true, completion: nil)
+6

All Articles