// // PopupView.m // Unity-iPhone // // Created by duowan123 on 2021/4/28. // #import "PopupView.h" #import "MBProgressHUD.h" @implementation PopupView //获取根视图 +(void)showCusHUDA:(NSString*)text{ UIViewController *rootVC = [[UIApplication sharedApplication].delegate window].rootViewController; UIViewController *parent = rootVC; while ((parent = rootVC.presentedViewController) != nil ){ rootVC = parent; } while ([rootVC isKindOfClass:[UINavigationController class]]){ rootVC = [(UINavigationController *)rootVC topViewController]; } // NSLog(@"dfd === %@",dfd); //load... MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:rootVC.view animated:YES]; hud.mode = MBProgressHUDModeText; hud.label.text = text; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [hud hideAnimated:YES]; }); } @end