Opening viewController programmatically in swift

后端 未结 3 1771
粉色の甜心
粉色の甜心 2021-02-07 13:27

I want to open new UIViewController on the button through code. I have already made the controller in storyboard and just want to link it and also I don\'t want to use XIB inter

3条回答
  •  终归单人心
    2021-02-07 13:56

    For swift 4.2, try the following code:

    self.navigationController!.pushViewController(self.storyboard!.instantiateViewController(withIdentifier: "inventoryViewController") as UIViewController, animated: true)
    

提交回复
热议问题