我已经查看了我可以在这个教程中找到的所有教程,但我仍然没有答案.我需要从代码中调用另一个视图.我在用UIStoryboards.我已经通过控制拖动多次更改了视图UIButtons,但现在它必须来自代码.如果是用户第一次打开应用程序,我试图从主菜单调用信息页面.但是,我似乎找不到从代码中更改视图的方法.我的所有视图都由相同的文件控制(ViewController2).在identifier我的主菜单是ViewControllerMain,而identifier该信息页面的是ViewControllerInfo.首先我尝试了这个:
[ViewControllerMain presentViewController: ViewControllerInfo
animated:YES
completion: NULL];
Run Code Online (Sandbox Code Playgroud)
然后我尝试UIViewControllers为每个人做出不同的说法:
[ViewController2 presentViewController: ViewController
animated:YES
completion: NULL];
Run Code Online (Sandbox Code Playgroud)
都没有奏效.对于第一个,它说:
使用未声明的标识符ViewControllerMain.
在第二个中,它说:
意外的接口名称'ViewController':预期的标识符.
我能做什么?
objective-c uiviewcontroller ios uistoryboard presentviewcontroller
我想通过代码在按钮上打开新的UIViewController.我已经在故事板中创建了控制器,只想链接它,我也不想使用XIB接口或nibName?