FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How do UIAlert control join the sio2window

2 posters

Go down

How do UIAlert control join the sio2window Empty How do UIAlert control join the sio2window

Post  guola Tue May 12, 2009 7:40 pm

I would like in the game,
Pop UIAlert Control
Please enter the name of the user

guola

Posts : 3
Join date : 2009-03-05

Back to top Go down

How do UIAlert control join the sio2window Empty Re: How do UIAlert control join the sio2window

Post  yarri Tue May 12, 2009 9:10 pm

In your ViewController (or ApplicationDelegate if you're using the demo templates) you can make a call to UIKit methods. The question is *when* do you want to display the dialog? For example, you can set up a "game over" timer with something like this in your applicationDidFinishLaunching: method:
Code:

   [NSTimer scheduledTimerWithTimeInterval:(float)gameOverTime target:self selector:@selector(alertShowGameOver:) userInfo:nil repeats:NO];

Where gameOverTime is the duration of your game and alertShowGameOver: is a method like this:
Code:

- (void)alertShowGameOver:(NSTimer *)timer {
   [glView stopAnimation];  // Stop the SIO2 animation, required EAGLView class instantiation
   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Game Over!" message:@"Play again or quit?" delegate:self cancelButtonTitle:@"Play Again" otherButtonTitles:@"Quit", nil];
   [alert show];  // Show the UIAlert
   [alert release];
}

You'll need to then implement the UIAlertView delegate methods to handle the alert. A similar approach can be used to create modal dialog with a UITextView via a call to presentModalViewController.

--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum