You can do it like (if you don't want to perform an event or generate a notification and just want to check if the alert is displayed or not), declaring a alertview as a class level variable and releasing it when your alertview is dismissed.
@interface ViewControllerA:UIViewController{
UIAlertView *theAlertView;
}
@property (nonatomic, retain) UIAlertView *theAlertView;
@end
@implementation ViewControllerA
@synthesize theAlertView;
- (void)showAlertView{
// theAlertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
// [theAlertview show];
self.theAlertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[self.theAlertview show];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
// [theAlerView release];
self.theAlertView=nil; // The synthesized accessor will handle releasing.
}
Now you can check it by:
if(viewControllerAClassObj.theAlertView){
}
Hope this helps,
Thanks,
Madhup