【发布时间】:2018-02-13 15:36:17
【问题描述】:
如何通过代码打开ViewController窗口?还是我需要为这个 ViewController 创建一个 NSWindow?
【问题讨论】:
标签: macos xamarin.mac monomac
如何通过代码打开ViewController窗口?还是我需要为这个 ViewController 创建一个 NSWindow?
【问题讨论】:
标签: macos xamarin.mac monomac
没有直接推送控制器的方法,而是您必须编写自己的代码来添加视图动画和视图控件。 在swift中我们可以实现如下:
func addSSChildViewController(child:NSViewController){
let subView = child.view;//Child
let parent = self.view;//Parent
self.addChildViewController(child)
parent.addSubview(subView)
}
其中self是父NSViewController继承类。
【讨论】:
var viewController = new SettingsViewController(new IntPtr()); this.AddChildViewController(viewController); this.View.AddSubview(viewController.View); 当我运行这段代码时,应用程序只是挂起
好的,我找到了解决问题的方法:method PerformSegue("SignInSegue", this); 我在故事板(Xcode)中设置了segue标识符,然后在方法中使用它。
【讨论】: