If you can control the other alert views, check the visible
property for each of them.
When an alert appears, it will be moved to a _UIAlertOverlayWindow. Therefore, a pretty fragile method is to iterate through all windows and check if there's any UIAlertView subviews.
for (UIWindow* window in [UIApplication sharedApplication].windows) {
UIView* subviews = window.subviews;
if ([subviews count] > 0)
if ([[subviews objectAtIndex:0] isKindOfClass:[UIAlertView class]])
return YES;
}
return NO;
This is undocumented as it depends on internal view hierarchy, although Apple cannot complain about this. A more reliable but even more undocumented method is to check if [_UIAlertManager visibleAlert]
is nil.
These methods can't check if a UIAlertView from SpringBoard is shown.