本文介绍了可可-以编程方式呈现NSViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 通常,我们可以通过具有不同类型的NSStoryboardSeque(例如Present,Show,Sheet等)来显示第一个视图控制器中的下一个视图控制器,但是,我们如何以编程方式实现相同的目标。 与UIViewController相比,通过 presentViewController:animated:模态地显示视图控制器。对于NSViewController,有没有相同的方法? 预先感谢。 解决方案我使用的两种不同的演示类型是: func presentViewControllerAsModalWindow(_ viewController:NSViewController) func presentViewControllerAsSheet(_ viewController:NSViewController) 经过更多研究之后,另一种使用方法: func presentViewController(_ viewController:NSViewController,animator: NSViewControllerPresentationAnimator) 并使用自定义演示动画器。在这里,您可以自由地做自己喜欢的事:) Generally, We can able to display next view controller from first view controller by having different kind of NSStoryboardSeque like Present, Show, Sheet etc., But, How we can achieve the same programmatically?.Comparing with UIViewController, presenting a view controller modally by presentViewController:animated:. Is there any same kind of approach for NSViewController?Thanks in advance. 解决方案 The two different presentation types I use are:func presentViewControllerAsModalWindow(_ viewController: NSViewController)func presentViewControllerAsSheet(_ viewController: NSViewController)After doing some more research another way to do using:func presentViewController(_ viewController: NSViewController, animator: NSViewControllerPresentationAnimator)And eating a custom presentation animator. Here you have the freedom to do what you like :) 这篇关于可可-以编程方式呈现NSViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-02 06:07