Could not find a storyboard named 'Main' in bundle NSBundle

后端 未结 4 1512
小蘑菇
小蘑菇 2021-02-05 09:22

during the progress of my app I decided to change from using a UIStoryboard to .xib file, and now I get the error:

Could not find a storyboard named \'Main\' in bun

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 09:26

    Add these line to your action method

    Where "Main" will be same as it as

    let storyboard = UIStoryboard.init(name: "Main", bundle: nil)

    let secondVc = storyboard.instantiateViewController(withIdentifier: "ControllerName") as! ControllerName

    present(secondVc, animated: true, completion: nil)

提交回复
热议问题