YOUPAILZLiveSendFestivalAlertVC.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // YOUPAILZLiveSendFestivalAlertVC.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/7/23.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveSendFestivalAlertVC.h"
  9. #import "NSString+YYAdd.h"
  10. @interface YOUPAILZLiveSendFestivalAlertVC ()
  11. /* 是否选中 */
  12. @property (assign, nonatomic) BOOL youpaipisSelect;
  13. @end
  14. @implementation YOUPAILZLiveSendFestivalAlertVC
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. self.baseView.hidden = YES;
  18. self.youpaipisSelect = NO;
  19. [self youpaifinitUI];
  20. }
  21. - (void)youpaifinitUI{
  22. UIView *bgV = [[UIView alloc] init];
  23. [self.view addSubview:bgV];
  24. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.mas_equalTo(31);
  26. make.right.mas_equalTo(-31);
  27. make.centerY.mas_equalTo(0);
  28. make.height.mas_equalTo(183);
  29. }];
  30. bgV.backgroundColor = [UIColor whiteColor];
  31. bgV.layer.cornerRadius = 10;
  32. bgV.layer.masksToBounds = YES;
  33. //详情
  34. NSString *contentStr = [NSString stringWithFormat:@"点击将赠送礼物【%@】给对方(价值%@钻石)",self.youpaipgiftName,self.youpaippriceStr];
  35. UILabel *detailLabel = [UILabel new];
  36. [bgV addSubview:detailLabel];
  37. [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.mas_equalTo(14);
  39. make.right.mas_equalTo(-14);
  40. make.top.mas_equalTo(20);
  41. make.height.mas_equalTo(42);
  42. }];
  43. detailLabel.text = contentStr;
  44. detailLabel.numberOfLines = 2;
  45. //不再提示按钮
  46. UIButton *hintBtn = [UIButton new];
  47. [bgV addSubview:hintBtn];
  48. [hintBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.centerX.mas_equalTo(0);
  50. make.top.mas_equalTo(detailLabel.mas_bottom).offset(20);
  51. // make.width.mas_equalTo(75);
  52. }];
  53. [hintBtn setTitle:@" 不再提示" forState:UIControlStateNormal];
  54. [hintBtn setTitleColor:HexColorFromRGB(0x9F9DA5) forState:UIControlStateNormal];
  55. hintBtn.titleLabel.font = [UIFont systemFontOfSize:14];
  56. [hintBtn setImage:[UIImage imageNamed:@"vqu_images_L_live_hint_No"] forState:UIControlStateNormal];
  57. [hintBtn setImage:[UIImage imageNamed:@"vqu_images_L_live_hint_select"] forState:UIControlStateSelected];
  58. //取消
  59. UIButton *cancelBtn = [UIButton new];
  60. [bgV addSubview:cancelBtn];
  61. [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.left.mas_equalTo(13);
  63. make.bottom.mas_equalTo(-20);
  64. make.size.mas_equalTo(CGSizeMake(ScaleSize(135), 48));
  65. }];
  66. [cancelBtn setTitle:@"先不送" forState:UIControlStateNormal];
  67. [cancelBtn setTitleColor:HexColorFromRGB(0xffffff) forState:UIControlStateNormal];
  68. cancelBtn.titleLabel.font = [UIFont systemFontOfSize:17];
  69. cancelBtn.layer.cornerRadius = 5.0f;
  70. cancelBtn.layer.masksToBounds = YES;
  71. [cancelBtn setBackgroundColor:HexColorFromRGB(0x9F9DA5)];
  72. //确定
  73. UIButton *sureBtn = [UIButton new];
  74. [bgV addSubview:sureBtn];
  75. [sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.right.mas_equalTo(-13);
  77. make.bottom.mas_equalTo(-20);
  78. make.size.mas_equalTo(CGSizeMake(ScaleSize(135), 48));
  79. }];
  80. [sureBtn setTitle:@"确定" forState:UIControlStateNormal];
  81. [sureBtn setTitleColor:HexColorFromRGB(0xffffff) forState:UIControlStateNormal];
  82. sureBtn.titleLabel.font = [UIFont systemFontOfSize:17];
  83. sureBtn.layer.cornerRadius = 5.0f;
  84. sureBtn.layer.masksToBounds = YES;
  85. [sureBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(ScaleSize(135), 48) FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1] forState:UIControlStateNormal];
  86. //按钮事件
  87. [hintBtn addTarget:self action:@selector(youpaifhintBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  88. [cancelBtn addTarget:self action:@selector(youpaifcancelBtnClick) forControlEvents:UIControlEventTouchUpInside];
  89. [sureBtn addTarget:self action:@selector(youpaifsureBtnClick) forControlEvents:UIControlEventTouchUpInside];
  90. }
  91. -(void)youpaifsureBtnClick{
  92. [self dismissViewControllerAnimated:YES completion:^{
  93. if (self.youpaipconfirmClickBlock) {
  94. self.youpaipconfirmClickBlock(self.youpaipisSelect);
  95. }
  96. }];
  97. }
  98. -(void)youpaifcancelBtnClick{
  99. [self dismissViewControllerAnimated:YES completion:^{
  100. }];
  101. }
  102. //是否选中
  103. -(void)youpaifhintBtnClick:(UIButton*)sender{
  104. sender.selected = !sender.selected;
  105. if (sender.selected) {
  106. self.youpaipisSelect = YES;
  107. }else{
  108. self.youpaipisSelect = NO;
  109. }
  110. }
  111. @end