objective c - showing menu view the same as in applicationDidFinishLaunching -


i have piece of code in myclassappdelegate:

    [[uiapplication sharedapplication] setstatusbarhidden:yes animated:no];     application.idletimerdisabled = yes;     [window setbackgroundcolor:[uicolor blackcolor]];      appbutton1 = [uibutton buttonwithtype:0];     [appbutton1 setimage:[uiimage imagenamed:@"a.png"] forstate:uicontrolstatenormal];     [appbutton1 addtarget:self action:@selector(startgame) forcontrolevents:uicontroleventtouchupinside];     [window addsubview:appbutton1];     [window makekeyandvisible];    -(void)startgame {     [appbutton1 removefromsuperview];     mgc = [[maingamecontroller alloc] initwithnibname:nil bundle:nil];;     [window addsubview:mgc.view];     [mgc.view setframe:[[uiscreen mainscreen] applicationframe]]; } 

it give user option play 1 or more games after app has launched (my code shows 1 option, can add more buttons if more selections required).

i create view @ end of game have "play again" , "menu" buttons. if user selects menu button want show user same view created inside applicationdidfinishlaunching. have remove existing views , add menu view done in applicationdidfinishlaunching? essentially, after user selects "menu" option start clean slate same inside applicationdidfinishlaunching.

you not have remove views, instead @ end view going create, user's activity lead him mgc's view. have implement game engine kind of work keep track of game status , game initialization, game level-up,etc.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -