Alert me, please

Some important things that you must do in iOS it’s to show a message in the middle of the screen. A popup, expert will say. Here’s a small code to do it.

- (void)SacaAlerta {
    // First, we create an object called alert part of the UIAlertView
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Text of the alert"
    [alert autorelease];
    [alert show];

Ok, you will not have the same as the image, but if you read the code it’s easy to put more buttons (otherButtonTitles) or messages in it (message). In this example there are equal to nil (or Null for friends).

Of course, you are enough smart to know that this function doesn’t return anything (void) and how you can use it 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.