UIAlertView *alert =
[[UIAlertView alloc] initWithTitle: @"Some Title"
message: @"You look very nice today."
delegate: self
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
If you want to know what got tapped, use a delegate method. The cancel button is index zero.
- (void) alertView: (UIAlertView *) alertView
clickedButtonAtIndex: (NSInteger) buttonIndex {
NSLog(@"foobage! %d", buttonIndex);
} // clickedButtonAtIndex