BogoNobleAlertView.m 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // BogoNobleAlertView.m
  3. // BuguLive
  4. //
  5. // Created by 宋晨光 on 2021/4/24.
  6. // Copyright © 2021 xfg. All rights reserved.
  7. //
  8. #import "BogoNobleAlertView.h"
  9. @implementation BogoNobleAlertView
  10. -(void)awakeFromNib{
  11. [super awakeFromNib];
  12. [self.confirmBtn setLocalizedString];
  13. // self.confirmBtn.userInteractionEnabled = NO;
  14. }
  15. - (IBAction)clickConfirmBtn:(UIButton *)sender {
  16. [self hide];
  17. // if (self.delegate && [self.delegate respondsToSelector:@selector(protocolNobleAlertClickConfirm:)]) {
  18. // [self.delegate protocolNobleAlertClickConfirm:sender];
  19. // }
  20. }
  21. #pragma mark - Lazy Load
  22. - (UIView *)shadowView{
  23. if (!_shadowView) {
  24. _shadowView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  25. _shadowView.backgroundColor = kGrayTransparentColor4_1;
  26. // [kBlackColor colorWithAlphaComponent:0.3];
  27. _shadowView.alpha = 0;
  28. _shadowView.userInteractionEnabled = YES;
  29. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hide)];
  30. [_shadowView addGestureRecognizer:tap];
  31. }
  32. return _shadowView;
  33. }
  34. - (void)setSelectModel:(BogoNobleListSubTypeModel *)selectModel{
  35. self.titieL.text = selectModel.title;
  36. [self.iconimgView sd_setImageWithURL:[NSURL URLWithString:selectModel.instructions_img] completed:nil];
  37. self.contentL.text = selectModel.content;
  38. if ([selectModel.title isEqualToString:ASLocalizedString(@"隐身进场")]) {
  39. self.height = kRealValue(261);
  40. self.bgImgView.image = [UIImage imageNamed:@"bogo_noble_AlertSmallBgImg"];
  41. self.labelConstraint.constant = kRealValue(30);
  42. }else{
  43. self.height = kRealValue(341);
  44. self.labelConstraint.constant = kRealValue(24);
  45. self.bgImgView.image = [UIImage imageNamed:@"bogo_noble_AlertBgImg"];
  46. }
  47. }
  48. - (void)show:(UIView *)superView{
  49. // [self requestWardData];
  50. [superView addSubview:self.shadowView];
  51. [superView addSubview:self];
  52. [UIView animateWithDuration:0.25 animations:^{
  53. self.center = CGPointMake(kScreenW / 2, kScreenH / 2);
  54. NSLog(@"%@",self);
  55. // self.bottom = kScreenHeight;
  56. // self.centerX = 185;
  57. // self.centerY = kScreenH / 2;
  58. self.shadowView.alpha = 1;
  59. }];
  60. }
  61. - (void)hide{
  62. [UIView animateWithDuration:0.15 animations:^{
  63. // self.top = kScreenH;
  64. // self.frame = CGRectMake(0, kScreenHeight, self.width, self.height);
  65. // self.center = CGPointMake(kScreenW / 2, kScreenH / 2);
  66. self.shadowView.alpha = 0;
  67. } completion:^(BOOL finished) {
  68. [self removeFromSuperview];
  69. [self.shadowView removeFromSuperview];
  70. }];
  71. }
  72. - (void)layoutSubviews {
  73. [super layoutSubviews];
  74. self.center = CGPointMake(kScreenW / 2, kScreenH / 2);
  75. }
  76. @end