4/25/2009

MVC pattern and Singleton

How do I access ItemViewController from GameViewController? Protocol and delegate? I still don't know how to do the MVC pattern right. Using singleton for Player stats and stuff...
GameViewControllerからItemViewControllerなどのアクセス方法を考える。Protocolとdelegateでやるのがいいのかな?プレイヤーデータはsingletonでいいや。と。


+ (Player *) getInstance
{
static Player *myInstance = nil;

@synchronized(self)
{
if( myInstance == nil ){
myInstance = [[Player alloc] init];
}
}
return myInstance;
}

No comments:

Post a Comment