简体   繁体   中英

Instantiating a ViewController when there's no storyboard

I have a rather simple iOS app build using MvvmCross .I need to integrate a few screens from a different project. In said project I'm using a story board and instantiates my view like below

Storyboard.InstantiateViewController ("Controller")

However when integrated into this particular project it throws because StoryBoard of the ViewController is null. So how would one instantiate a controller and have all the subviews laid out in a case like this?

If your current controller is not created from a storyboard, its Storyboard property is null. You can however load the storyboard itself using the static:

UIStoryboard.FromName(string name)

This will get you a storyboard reference and from there you can use

InstantiateviewController(string storyboardId)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM