Hi,
In apps I've created I usually attach the cocos2d director to a view i.e.
[[Director shareddirector] attachInView:myView];
This means that I can overlay other views loaded from nibs in front of it. E.g. I could do something like . . .
in YourAppDelegate.h
GameViewController *gameViewController;
ScoresViewcontroller *scoresViewController;
....
@property (nonatomic, retain) GameViewController *gameViewController;
@property (nonatomic, retain) ScoresViewController *scoresViewController;
and in YourAppDelegate.m inside applicationDidFinishLaunching:
// Create the cocos2d view
gameViewController = [[GameViewController alloc] init];
[window addSubview:gameViewController.view];
// Create the high scores view and controller
scoresViewController = [[ScoresViewController alloc] initwithNibName:@"scoresNib"
bundle:nil];
[window addSubview:scoresViewController.view];
Finally, inside the GameViewController you would have
- (void) loadView {
self.view = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,480)];
[[Director sharedDirector] attachInView:self.view];
// Now do your cocos2d scene stuff to start everything off e.g. create a scene
// and call runWithScene: on the sharedDirector
}
Here, the cocos2d code is running in the background and the scores view is overlaid in front (or hidden until you need it etc).
Then, when your game needs to do something to the high scores, the GameViewController can just get the HighScoresViewController from the app delegate i.e.
YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.scoresViewController.view.hidden = NO;
Sam
PS The answers to this question might also be useful to you :)