nonWifiTipInRecordView.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // nonWifiTipInRecordView.m
  3. // Private-X
  4. //
  5. // Created by xd h on 2024/10/17.
  6. //
  7. #import "nonWifiTipInRecordView.h"
  8. @implementation nonWifiTipInRecordView
  9. - (id)initWithFrame:(CGRect)frame{
  10. self = [super initWithFrame:frame];
  11. self.backgroundColor = [UIColor whiteColor];
  12. [self drawAnyView];
  13. return self;
  14. }
  15. - (void)drawAnyView{
  16. UIView *whiteBgView = [[UIView alloc] init];
  17. whiteBgView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:0.1];
  18. whiteBgView.layer.cornerRadius = 8;
  19. [self addSubview:whiteBgView];
  20. [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.left.mas_equalTo(0);
  22. make.right.mas_equalTo(0);
  23. make.height.mas_equalTo(56);
  24. make.bottom.mas_equalTo(0);
  25. }];
  26. //感叹号
  27. UIImageView * tipImageV = [[UIImageView alloc] init];
  28. tipImageV.image = [UIImage imageNamed:@"common_red_gantanhao"];
  29. [whiteBgView addSubview:tipImageV];
  30. [tipImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.mas_equalTo(12);
  32. make.width.mas_equalTo(16);
  33. make.height.mas_equalTo(16);
  34. make.centerY.mas_equalTo(0);
  35. }];
  36. //去开启
  37. NSString *buttonTitle = NSLocalizedString(@"common_wwan_open_tip",nil);
  38. UIButton *openButton = [[UIButton alloc] init];
  39. openButton.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  40. [openButton setTitle:buttonTitle forState:UIControlStateNormal];
  41. [openButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  42. openButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  43. openButton.layer.cornerRadius = 4;
  44. openButton.userInteractionEnabled = NO;
  45. [whiteBgView addSubview:openButton];
  46. [openButton mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.right.mas_equalTo(-12);
  48. make.width.mas_equalTo(52);
  49. make.height.mas_equalTo(23);
  50. make.centerY.mas_equalTo(0);
  51. }];
  52. //提示文字
  53. UILabel *tipLabel = [[UILabel alloc] init];
  54. tipLabel.text = NSLocalizedString(@"no_wifi_warn_tip",nil);
  55. tipLabel.font = [UIFont systemFontOfSize:12.0];
  56. tipLabel.textColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  57. tipLabel.numberOfLines = 2;
  58. [whiteBgView addSubview:tipLabel];
  59. [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.top.mas_equalTo(0);
  61. make.bottom.mas_equalTo(0);
  62. make.left.equalTo(tipImageV.mas_right).offset(8);
  63. make.right.equalTo(openButton.mas_left).offset(-15);
  64. }];
  65. [whiteBgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoOpenFun)]];
  66. }
  67. - (void)gotoOpenFun
  68. {
  69. if(_didClickBut){
  70. _didClickBut();
  71. }
  72. }
  73. @end