How do UIAlert control join the sio2window
2 posters
How do UIAlert control join the sio2window
I would like in the game,
Pop UIAlert Control
Please enter the name of the user
Pop UIAlert Control
Please enter the name of the user
guola- Posts : 3
Join date : 2009-03-05
Re: How do UIAlert control join the sio2window
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:
Where gameOverTime is the duration of your game and alertShowGameOver: is a method like this:
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
- 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
Similar topics
» Join objects and materials problem?
» How to control the game fps?
» Transformations not happening
» how to control a object which serve as a skeletal animation
» How to control the game fps?
» Transformations not happening
» how to control a object which serve as a skeletal animation
Permissions in this forum:
You cannot reply to topics in this forum