MJExampleWindow.m 889 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // MJExampleWindow.m
  3. // MJRefreshExample
  4. //
  5. // Created by MJ Lee on 15/8/17.
  6. // Copyright (c) 2015年 小码哥. All rights reserved.
  7. //
  8. #import "MJExampleWindow.h"
  9. #import "MJTempViewController.h"
  10. @implementation MJExampleWindow
  11. static UIWindow *window_;
  12. + (void)show
  13. {
  14. window_ = [[UIWindow alloc] init];
  15. CGFloat width = 150;
  16. CGFloat x = [UIScreen mainScreen].bounds.size.width - width - 10;
  17. CGFloat y = 0;
  18. if (@available(iOS 11.0, *)) {
  19. UIEdgeInsets safeInsets = UIApplication.sharedApplication.windows.firstObject.safeAreaInsets;
  20. y = safeInsets.top;
  21. }
  22. window_.frame = CGRectMake(x, y, width, 25);
  23. window_.windowLevel = UIWindowLevelAlert;
  24. window_.hidden = NO;
  25. window_.alpha = 0.5;
  26. window_.rootViewController = [[MJTempViewController alloc] init];
  27. window_.backgroundColor = [UIColor clearColor];
  28. }
  29. @end