PresentViewController 故障排除

PresentViewController Troubleshooting

在我的 swift 应用程序中,我正在尝试实现点击按钮切换视图控制器。这是我使用的代码:

presentViewController(pythTheoremViewController.self, animated: true, completion: nil)

此 returns 错误“无法使用类型的参数列表调用 'presentViewController'')pythTheoremViewController.Type,动画:Bool,完成:nil)

这是什么意思,我该如何解决?

如果您的 ViewController-实例是 pythTheoremViewController,删除 self

抱歉这个愚蠢的问题!当我应该在视图控制器名称后使用 () 时,我使用了自动更正 .self 选项。