//Code to delete an Alert Window
for (UIWindow *window in [UIApplication sharedApplication].windows) {
NSArray *subviews = window.subviews;
if ([subviews count] > 0) {
for (int k=0; k<[subviews count]; k++) {
BOOL alert = [[subviews objectAtIndex:k] isKindOfClass:[UIAlertView class]];
if (alert) {
NSLog(@"alert exists");
// Delete an Alert
[(UIAlertView *)[subviews objectAtIndex:k] dismissWithClickedButtonIndex:[(UIAlertView *)[subviews objectAtIndex:k] cancelButtonIndex] animated:NO];
break;
}
}
}
}
No comments:
Post a Comment