views:

43

answers:

1

Hello.

I'm relatively new in this things...

In my project, I've got 3 Views(derived from UIView):

1) SplashView (game logo and "Play" button)

2) SelectLevelView (1 to 20 different levels button)

3) GameView (load the selected level in SelectLevelView)

All views are programmed using code (drawRect).

SplashScreenView is loaded with something like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    

    // Override point for customization after application launch.

    splashView = [[SplashView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

    [window addSubview:splashView];
    [window makeKeyAndVisible];

    return YES;
}

In SplashView, when touch the "Play" button, I add SelectLevelView to it (using [self addSubView:selectLevelView]) and when I select de level that I want to play I add GameView to SelectLevelView... but... I guess this is no the best approach to do this.

So... What is the best approach to managing this Views?

Using UIViewController? but... how can I access to it in GameView?

I don't know, I'm confusing and my progress is zero at this moment.

Thank you ;)

A: 

What do you mean by

Using UIViewController? but... how can I access to it in GameView?

Why can't you access to it in GameView ?

Just to be sure : and UIViewController is a wrapper around the view. Here in a nutshell what's in the UIViewController.h

UIViewController {
  UIView view;
}

- someUsefullFunctions ();
TheSquad
thanks, but... can you give an example of how manage this 3 views? I mean... when I press "Play"(in the first view loaded, in SplashView) I want replace SplashView by SelectLevelView instead of add it... and the same thing when I select the level in SelectLevelView... i want to replace this view by GameView. thank you again.
Pittor