APHomeActiveWindow.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // APHomeActiveWindow.m
  3. // westkissMob
  4. //
  5. // Created by iOS on 2023/5/26.
  6. //
  7. #import "APHomeActiveWindow.h"
  8. #import "APHomeActiveViewController.h"
  9. #import "APInputAlertView.h"
  10. @interface APHomeActiveWindow ()
  11. @property (nonatomic, strong) APHomeActiveViewController *vc;
  12. @end
  13. @implementation APHomeActiveWindow
  14. - (instancetype)initWithFrame:(CGRect)frame {
  15. self = [super initWithFrame:frame];
  16. if (self) {
  17. [self createVc];
  18. }
  19. return self;
  20. }
  21. - (void)createVc {
  22. self.windowLevel = UIWindowLevelStatusBar + 3;
  23. self.vc = [[APHomeActiveViewController alloc] init];
  24. self.vc.view.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.4];
  25. self.rootViewController = self.vc;
  26. [self makeKeyAndVisible];
  27. }
  28. // 输入框弹窗
  29. + (APHomeActiveWindow *)show:(NSString *)title des:(NSString *)des sureBlock:(void(^)(NSString*))success cancelBlock:(void(^)(void))cancel {
  30. APInputAlertView *contentV = [[APInputAlertView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
  31. [contentV setTitle:title des:des];
  32. APHomeActiveWindow *w = [[APHomeActiveWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  33. w.backgroundColor = UIColor.clearColor;
  34. ASWindowManager.share.activeW = w;
  35. [w.vc.view addSubview:contentV];
  36. [contentV mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.bottom.trailing.leading.equalTo(w.vc.view);
  38. }];
  39. contentV.sureAction = success;
  40. contentV.cancelAction = cancel;
  41. contentV.closeAction = cancel;
  42. return w;
  43. }
  44. @end