我已经查看了所有能找到的教程,但仍然无法得到答案。我需要从代码中调用另一个视图。我正在使用 UIStoryboards
。我曾经通过控制拖动 UIButtons
来多次更改视图,但现在必须通过代码来实现。我正在尝试在用户第一次打开应用程序时从主菜单调用信息页面。然而,我似乎找不到从代码中更改视图的方法。所有的视图都由同一文件(ViewController2)控制。我的主菜单的 identifier
是 ViewControllerMain,信息页面的 identifier
是 ViewControllerInfo。首先我尝试了以下代码:
[ViewControllerMain presentViewController: ViewControllerInfo
animated:YES
completion: NULL];
接着我尝试为每一个制作不同的UIViewController
并说:
[ViewController2 presentViewController: ViewController
animated:YES
completion: NULL];
两个都没有起作用。第一个说:
使用未声明的标识符ViewControllerMain。
在第二个中,它说:
意外的接口名称 'ViewController':期望标识符。
我该怎么办?