user1180709
user1180709

Reputation:

iPhone Dev: UIAlertView Won't Show

I have a button linked up to an IBAction called sendWO. This should be insanely simple, perhaps I'm missing some fundamental concept of the UIAlertView class. It's hooked up in my viewcontoller, and if I put in some NSLogs I know the button is calling the sendWO class correctly, it just doesn't show the alert. No warnings/crashes or anything like that. I've tried using delegate:nil , sender, self too, and removing the argument completely.

- (IBAction)sendWO:(id)sender
{
    NSString *theMessage = [NSString stringWithFormat:@"Thank you! We will call you     shortly at %@ to confirm.",choices.customerPhone];
    UIAlertView *alert = [alert initWithTitle:@"Thank you!" message:theMessage 
delegate:sender cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];    
}

Upvotes: 0

Views: 463

Answers (1)

Jesse Black
Jesse Black

Reputation: 7976

You are missing something simple:

You have to alloc the alertview

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thank you!" message:theMessage 
delegate:sender cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [alert show];    

    [alert autorelease];  

Upvotes: 1

Related Questions