1

I'm going to preface this question with the fact that I'm a complete novice in IOS, and I'm trying to learn as I go here.

The app I'm working on has a single Navigation Controller containing a Title Screen View Controller containing the app options. When I click the start button in the Title Screen it takes me to the Main Game Screen View Controller which has a CCLayer for doing some simple Cocos2D animation. All of this is working very well. Here's what I'm missing. I'm trying to programmatically go back to the title screen. I'm thinking there might be 2 options

1 - End the CCLayer somehow which will return me back to the Main Game View Controller where I can then send a command to go to the Title View Controller?

2 - Get a reference to the parent view controller of the CCLayer, and do the same as above.

I've scoured the internet for a couple of days trying to find what to do, and I'm out of ideas. I don't really have anything to show apart from I think I need to initialize the Title View Controller again.

Any ideas will be appreciated, thanks for your time.

4

2 回答 2

1

正如你提到的,你有一个导航控制器,这意味着你的主游戏视图控制器被推到你的标题视图控制器上。

并且您的 CCLayer 已添加到 MainGameView 控制器

所以你需要做的就是弹出你的 MainGameViewController。这将自动将您带到您的titleViewController。

于 2013-09-13T05:42:40.367 回答
1

你只需要写在你的动作方法中

[[CCDirector sharedDirector] popScene];

您将在前一个场景中。

于 2013-09-13T04:46:06.313 回答