Check if a UIAlertView is showing

后端 未结 10 1343
刺人心
刺人心 2020-11-27 16:45

I have a method that posts HTTP data and displays a UIAlertView if there is an error. If I have multiple HTTP post I will show multiple UIAlertView for every error.

10条回答
  •  自闭症患者
    2020-11-27 17:20

    - (BOOL)checkAlertExist {
        for (UIWindow* window in [UIApplication sharedApplication].windows) {
            NSArray* subviews = window.subviews;
            if ([subviews count] > 0) {
                for (id cc in subviews) {
                    if ([cc isKindOfClass:[UIAlertView class]]) {
                        return YES;
                    }
                }
            }
        }
        return NO;
    }
    

提交回复
热议问题