Home > iphone, The Prince: C > How to Display an Alert on the iPhone

How to Display an Alert on the iPhone

On the iPhone, to display an alert message to the user you can use the UIAlertView class.

This class is declared in the UIAlertView.h header file.


For your convenience you can use the following method to initialize an alert view:

initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:

Using this method you will have a code like the following:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:[array objectAtIndex:0] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];


to Show the alert you shall use the following code:

[alert show];


At the end you shall release the alert

[alert release];


gg1

  1. No comments yet.
  1. No trackbacks yet.
*

Statistical data collected by Statpress SEOlution (blogcraft).