【问题标题】:Adding a Monotouch.Dialog to a standard view将 Monotouch.Dialog 添加到标准视图
【发布时间】:2013-05-27 22:33:48
【问题描述】:

我有一个标准视图,顶部有一个导航栏。我还在它自己的源文件中设置了 Monotouch.Dialog。我已经四处寻找解决方案,但似乎找不到关于如何将 MTD 添加到普通视图的明确答案。

有没有简单的方法来做到这一点?

【问题讨论】:

    标签: monotouch.dialog


    【解决方案1】:

    您实例化 DialogViewController 并将其视图添加到 您的视图。

    DialogViewController vc = new DialogViewController(null);
    
    // Build and set your root here.
    
    vc.View.Frame = new RectangleF(20f, 20f, 280f, 560f);
    
    this.View.AddSubview(vc.View);
    

    在这种情况下,您可能会遇到 ViewController 方法(即旋转方法)未正确转发的问题,因此请务必进行测试。

    这非常难看,只有在您绝对必须嵌套 Dialog 视图时才应使用。

    在 DialogViewController 全屏显示(有或没有导航栏)的场景中,更优雅的解决方案是使用 UINavigationController 作为应用程序中的根视图控制器(这将负责导航栏你),然后将新创建的 DialogViewController 设置或推送到它上面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 2017-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多