views:

2365

answers:

4

Does anyone have any best practices, tips & tricks, or recommendations for how to create modal Alert Views with Cocoa Touch?

I like to think there is a way to make this difficult task trivial or at least easier.

+1  A: 

I just use UIAlertView to display modal alerts. What additional functionality are you looking for?

Ben Gottlieb
+7  A: 

You can use something like this:

void AlertWithMessage(NSString *message)
{
/* open an alert with an OK button */
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Name of the Application" 
        message:message
           delegate:nil 
        cancelButtonTitle:@"OK" 
           otherButtonTitles: nil];
[alert show];
[alert release];
}
Geraud.ch
+1  A: 

Check out the UICatalog sample code from Apple. It shows the usage of both Alerts and Sheets on the phone.

August
A: 

@Brad: you must add delegate:self to block the call

Developer IT