Monotouch Storyboard,带有无xib视图控制器

Jam*_*e D 5 storyboard xib xamarin.ios ios

我目前有monotouch项目,它使用Storyboard和一些xib-less(在Storyboard中没有相应的xib或引用的ViewControllers)控制器(例如Monotouch.Dialog)的组合.

一切都很好,从Storyboard ViewControllers调用到无xib的那些.我遇到的问题是当我需要从无xib的ViewController调用回到Storyboard ViewController时.

示例流程:

  • 故事板
    • TabViewController
      • FirstViewController DialogViewController(不在Storyboard/xib-less中)
        • AnotherViewController

问题是加载AnotherViewController时,例如.

var avc = new AnotherViewController();
avc.Person = person
_dvc.ActivateController(avc);
Run Code Online (Sandbox Code Playgroud)

我必须在AnotherViewController上创建一个空构造函数才能实现这一点.然后加载此视图,但它只是一个空的UIViewController(不是我的Storyboard中的那个).我无法在Interface Builder中使用AnotherViewController在MT.Dialog之间设置Segue,因为DialogViewController是以编程方式创建的.

解决方法atm是完全忘记Storyboard中的AnotherViewController并且只是以编程方式创建那个 - 但是真的很遗憾我无法将Storyboard视图与程序化视图结合/混合.

任何提示(或Monotouch C#片段)将不胜感激!

Eze*_*eki 0

您可以从创建一个控制器Storyboard,只需添加identifier到它(在情节提要中),然后执行以下操作:

YourController *c = 
[storyboard instantiateViewControllerWithIdentifier:@"YourIdentifier"];
Run Code Online (Sandbox Code Playgroud)

不要忘记在 中初始化您的实例viewDidLoad,因为initWithNibName永远不会被调用