ASCustomWindow.m 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // ASCustomWindow.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/12/23.
  6. //
  7. #import "ASCustomWindow.h"
  8. @implementation ASCustomWindow
  9. - (instancetype)initWithFrame:(CGRect)frame {
  10. self = [super initWithFrame:frame];
  11. if (self) {
  12. [self createVc];
  13. }
  14. return self;
  15. }
  16. - (void)createVc {
  17. self.windowLevel = UIWindowLevelStatusBar + 3;
  18. self.vc = [[ASCustomAlertViewController alloc] init];
  19. self.rootViewController = self.vc;
  20. [self makeKeyAndVisible];
  21. }
  22. + (ASCustomWindow *)show:(NSString *)version isMast:(BOOL)isMast upBlock:(void(^)(void))success cancelBlock:(void(^)(void))cancel {
  23. ASCustomWindow *w = [[ASCustomWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  24. w.backgroundColor = UIColor.clearColor;
  25. ASWindowManager.share.customW = w;
  26. w.vc.conetntLb.text = version;
  27. [w.vc setMastStatus:isMast];
  28. w.vc.sureAction = ^{
  29. success();
  30. };
  31. w.vc.cancelAction = ^{
  32. cancel();
  33. };
  34. w.vc.closeAction = ^{
  35. };
  36. return w;
  37. }
  38. @end