如何在应用程序启动时打开多个窗口?

问题描述 投票:0回答:1

我正在使用Xamarin.Mac构建一个MacOS应用程序。是否可以在应用程序启动时自动打开多个窗口?我已经尝试了一些事情,包括。

  • 实例化窗口控制器,并从AppDelegate和ViewController中调用ShowWindow()。
  • 在Xcode中为第二个窗口的视图控制器设置启动时可见。

我肯定我错过了什么,但什么?

谢谢!我正在使用Xamarin.Mac构建一个MacOS应用程序。

xcode xamarin xamarin.mac
1个回答
1
投票

如果将窗口控制器从Xamarin.Mac中实例化,那么就可以在应用启动时自动打开多个窗口。故事板 您可以按以下方式显示窗口。

// Get new window
var storyboard = NSStoryboard.FromName ("Main", null);
var controller = storyboard.InstantiateControllerWithIdentifier ("OtherWindow") as NSWindowController;

// Display
controller.ShowWindow(this);

更多信息请参考 在多个窗口工作 文件

© www.soinside.com 2019 - 2024. All rights reserved.