I have looked at all the tutorials I can find on this one, and I still don't have the answer. I need to call another view from the code. I am using UIStoryboards
. I have changed the view many times by control-dragging from UIButtons
, but now it must be from the code. I am trying to call the info page from the main menu if it is the first time the user has opened the app. I cannot seem to find a way to change the views from the code, however. All my views are controlled by the same files (ViewController2). The identifier
of my main menu is ViewControllerMain, and the identifier
of the info page is ViewControllerInfo. First I tried this:
[ViewControllerMain presentViewController: ViewControllerInfo
animated:YES
completion: NULL];
Then I tried making different UIViewControllers
for each and saying:
[ViewController2 presentViewController: ViewController
animated:YES
completion: NULL];
Neither worked. For the first one, it says:
Use of undeclared identifier ViewControllerMain.
In the second one, it says:
unexpected interface name 'ViewController': expected identifier.
What can I do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…