JXShowMainView.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // JXShowMainView.m
  3. // shiku_im
  4. //
  5. // Created by 123 on 2020/6/11.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXShowMainView.h"
  9. @interface JXShowMainView()<UITextViewDelegate>
  10. @property (weak, nonatomic) IBOutlet UIView *whiteView;
  11. @property (nonatomic,weak) JXShowMainView *showView;
  12. @property (weak, nonatomic) IBOutlet UIButton *closeButton;
  13. @end
  14. @implementation JXShowMainView
  15. +(instancetype)XIBJXShowMainView{
  16. return [[NSBundle mainBundle]loadNibNamed:@"JXShowMainView" owner:self options:nil].firstObject;
  17. }
  18. -(void)awakeFromNib{
  19. [super awakeFromNib];
  20. self.userInteractionEnabled=YES;
  21. _whiteView.layer.cornerRadius=12;
  22. _whiteView.layer.masksToBounds=YES;
  23. _closeButton.layer.cornerRadius=18;
  24. _closeButton.layer.masksToBounds=YES;
  25. _closeButton.layer.borderColor=[UIColor whiteColor].CGColor;
  26. _closeButton.layer.borderWidth=1;
  27. _whiteView.backgroundColor=[UIColor colorWithWhite:1.0 alpha:0.9];
  28. [_closeButton addTarget:self action:@selector(closeBtn:) forControlEvents:UIControlEventTouchUpInside];
  29. }
  30. +(void)showView{
  31. JXShowMainView *show=[JXShowMainView XIBJXShowMainView];
  32. show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.3];
  33. show.frame=[UIScreen mainScreen].bounds;
  34. [[UIApplication sharedApplication].keyWindow addSubview:show];
  35. }
  36. - (IBAction)closeBtn:(UIButton *)sender {
  37. [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"33000"];
  38. [self removeFromSuperview];
  39. [self removeFromSuperview];
  40. }
  41. @end