search
top

Obj-C: UIAlert

Display a simple message to the user thus:

UIAlertView *alert =
        [[UIAlertView alloc] initWithTitle: @"Title goes here"
                             message: @"Message goes here"
                             delegate: self
                             cancelButtonTitle: @"OK"
                             otherButtonTitles: nil];
    [alert show];
    [alert release];

If you want to catch the button press :

- (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) id {
    NSLog(@"button clicked: %d", id);
}

Leave a Reply

top