Specify two separate UIAlertView files in the .h file
@interface XYZViewController:UIViewController
{
UIAlertView *firstAlertView;
UIAlertView *secondAlertView;
}
Now in your .m file, modify as shown below:
-(IBAction)resetPressed:(id)sender
{
NSString *title= [NSString stringWithFormat:@"Warning"];
NSString *message = [NSString stringWithFormat:@"Are you sure you want to Reset"];
NSString *ok = [NSString stringWithFormat:@"No"];
if(firstAlertView == nil)
{
firstAlertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:ok otherButtonTitles:@"Yes",nil];
}
[firstAlertView show];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (alertView == firstAlertView)
{
NSString *title= [NSString stringWithFormat:@"Warning"];
NSString *message = [NSString stringWithFormat:@"Are you sure you want to Reset"];
NSString *ok = [NSString stringWithFormat:@"No"];
if(secondAlertView == nil)
{
secondAlertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:ok otherButtonTitles:@"Yes",nil];
}
[secondAlertView show];
}
else if(alertView == secondAlertView)
{
[self resetArray];
}
}
and in the dealloc method release the highlighted UIA images.
I hope you understand me.
Thanks,
Jim.
source
share