tags:

views:

85

answers:

2

i have a problem about alerts when i am adding following to my program it shows error UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"That's it" message:@"THANKS FOR USING" delegate:self cancelButtonTitle:@"bye" otherButtonTitles:nil];

[alert show];   

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
        NSLog(@"Button %d pressed", buttonIndex);
        [ alertView release ];
    }

this shows errors----alertView undeclared and expected ; before: please solve my problem i want to perform some actions when i click button on alert.

A: 

This will help

org.life.java
+1  A: 

In which line are you getting the error and what is the exact error? Have you added the UIAlertViewDelegate protocol in the interface declaration? It seems that you have not.

And you don't need to release alertView in delegate method. You can just release it after showing.

UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"That's it" message:@"THANKS FOR USING" delegate:self cancelButtonTitle:@"bye" otherButtonTitles:nil];
[alert show];
[alert release];
taskinoor