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

Posted by at June 26, 2010
Filed in category: iphone, The Prince: C, and tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

Statistical data collected by Statpress SEOlution (blogcraft).