I have Scenario like,
I scheduled 2-3 alarms in my iPhone. Now I am running my app. When my app is executing, and if alarm has been triggered(or any other type of alert shown in my device), i want to know about that alert programmatically to App and do some task according to the alert i got. so, just i want to know that is there anyway by which you get to know that some alert has been displayed(may be system alert) on your screen.
1 に答える
0
次の方法で実行できます: (システム アラートではテストされていません)
- (BOOL)isALertOnScreen
{
for (UIWindow* window in [UIApplication sharedApplication].windows)
{
NSArray* subviews = window.subviews;
if ([subviews count] > 0)
{
for (id obj in subviews)
{
DLog(@"%@",[obj class]);
if ([obj isKindOfClass:[UIAlertView class]])
return YES;
}
}
}
return NO;
}
于 2013-12-11T09:20:13.617 に答える