I want to make a single listener which grabs UIAlertView whenever it is shown to users.
I first setup this observer.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowDidBecomeVisible:)
name:UIWindowDidBecomeVisibleNotification
object:nil];
and then get UIWindow object like below.
- (void)windowDidBecomeVisible:(NSNotification *)notification
{
UIWindow *window = [notification object];
}
But from this window object, I cannot get UIAlertView. There is only one subview under this window and that subview doesn't have any subviews.
Below link shows the code to get a UIAlertView object from the window object, but this doesn't work. https://stackoverflow.com/a/2529692/1709287
Maybe iOS7 does some trick to make UIAlertView wrapped and hidden. Does anyone know how to track down UIWindow object's subviews (or members) to reach UIAlertView object which is currently shown on the screen ?