| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | ////  ASHomeAlertWindow.m//  Asteria////  Created by iOS on 2023/6/16.//#import "ASHomeAlertWindow.h"#import "ASHomeAlertViewController.h"#import "ASDefualtAlertV.h"ASHomeAlertWindow * _Nullable homeAlertW;@interface ASHomeAlertWindow ()@property (nonatomic, strong) ASHomeAlertViewController *vc;@end@implementation ASHomeAlertWindow+ (void)clearWindow {    for ( UIView *v in [homeAlertW.vc.view subviews]) {        [v removeFromSuperview];    }    homeAlertW = nil;}- (instancetype)initWithFrame:(CGRect)frame {    self = [super initWithFrame:frame];    if (self) {        [self createVc];    }    return self;}- (void)createVc {    self.windowLevel = UIWindowLevelStatusBar + 3;    self.vc = [[ASHomeAlertViewController alloc] init];    self.vc.view.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.7];    self.rootViewController = self.vc;    [self makeKeyAndVisible];}+ (void)alertMsg:(NSString *)message {    ASDefualtAlertV *v = [[ASDefualtAlertV alloc] initWithFrame:CGRectZero];    [v setMsg:message];    [v setViewStyle:ASAlertWidthStyleLittle];    [ASHomeAlertWindow showCustomVc:v position:ASAlertPositionCenter];}+ (void)showCustomVc:(UIView *)v position:(ASAlertPosition)postion {    ASHomeAlertWindow *w = [[ASHomeAlertWindow alloc] initWithFrame: UIScreen.mainScreen.bounds];    w.backgroundColor = UIColor.clearColor;    [w.vc.view addSubview:v];    homeAlertW = w;        [v mas_makeConstraints:^(MASConstraintMaker *make) {        make.leading.trailing.equalTo(w.vc.view);        switch (postion) {            case ASAlertPositionTop:                make.top.equalTo(w.vc.view);                break;            case ASAlertPositionBottom:                make.bottom.equalTo(w.vc.view);                break;                            default:                make.center.equalTo(w.vc.view);                break;        }            }];        }@end
 |