You could create your own class MyAlertView
that shows the alert normally but posts notifications for events like showing the view and being dismissed.
Just create a class with a simple interface like -showAlertWithTitle:
// Class interface
- (void)showAlertWithTitle:(NSString*)string
{
[[UIAlertView alloc] initWithTitle:string message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
}
// UIAlertViewDelegate methods
- (void)didPresentAlertView:(UIAlertView *)alertView
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"MyAlertViewDidPresentAlert" object:nil];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"MyAlertViewDidDismissAlert" object:nil];
}
Something like that.
In the first viewController you would need this:
// First viewController
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didPresentAlert:) name:@"MyAlertViewDidPresentAlert" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didDismissAlert:) name:@"MyAlertViewDidDismissAlert" object:nil];
}
- (void)didPresentAlert:(NSNotification*)notification
{...}
- (void)didDismissAlert:(NSNotification*)notification
{...}