PopupView.m 966 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // PopupView.m
  3. // Unity-iPhone
  4. //
  5. // Created by leon on 2021/4/28.
  6. //
  7. #import "PopupView.h"
  8. #import "MBProgressHUD.h"
  9. //ViceAnimation
  10. @implementation PopupView
  11. //获取根视图
  12. +(void)showCusHUDA:(NSString*)text{
  13. UIViewController *rootVC = [[UIApplication sharedApplication].delegate window].rootViewController;
  14. UIViewController *parent = rootVC;
  15. while ((parent = rootVC.presentedViewController) != nil ){
  16. rootVC = parent;
  17. }
  18. while ([rootVC isKindOfClass:[UINavigationController class]]){
  19. rootVC = [(UINavigationController *)rootVC topViewController];
  20. }
  21. // NSLog(@"dfd === %@",dfd);
  22. //load...
  23. MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:rootVC.view animated:YES];
  24. hud.mode = MBProgressHUDModeText;
  25. hud.label.text = text;
  26. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  27. [hud hideAnimated:YES];
  28. });
  29. }
  30. @end