YOUPAILZApplyRefundWindow.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // YOUPAILZApplyRefundWindow.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/4/29.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZApplyRefundWindow.h"
  9. @interface YOUPAILZApplyRefundWindow ()
  10. @property (nonatomic,weak) ZCLiveTextView *youpaiptextView;
  11. @property (nonatomic,assign) CGFloat youpaipbgV_y;
  12. @property (nonatomic,weak) UIView *youpaipbgV;
  13. @end
  14. @implementation YOUPAILZApplyRefundWindow
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. self.baseView.hidden = YES;
  18. [self youpaifinitUI];
  19. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifkeyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  20. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifkeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
  21. }
  22. - (void)youpaifinitUI{
  23. UIView *bgV = [[UIView alloc] init];
  24. bgV.backgroundColor = [UIColor whiteColor];
  25. bgV.layer.cornerRadius = 16.0f;
  26. bgV.clipsToBounds = YES;
  27. [self.view addSubview:bgV];
  28. self.youpaipbgV = bgV;
  29. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.left.offset(32.0f);
  31. make.right.offset(-32.0f);
  32. make.centerY.equalTo(self.view);
  33. }];
  34. UILabel *titleL = [[UILabel alloc] init];
  35. titleL.font = LCBoldFont(19.0f);
  36. titleL.textColor = HexColorFromRGB(0x333333);
  37. titleL.textAlignment = NSTextAlignmentCenter;
  38. titleL.text = @"请输入退款原因";
  39. [bgV addSubview:titleL];
  40. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.top.offset(30.0f);
  42. make.left.offset(14.0f);
  43. make.right.offset(-14.0f);
  44. }];
  45. ZCLiveTextView* textView = [[ZCLiveTextView alloc]initWithFrame:CGRectMake(20.0f, 72.0f, KScreenWidth-104.0f, 96.0f) TopMargin:5 LeftMargin:14];
  46. textView.backgroundColor = [HexColorFromRGB(0xEEEEEE) colorWithAlphaComponent:0.43f];
  47. textView.textLength = 100;
  48. textView.placeholder = @"请输入退款原因…";
  49. textView.placeholderColor = HexColorFromRGB(0x999999);
  50. textView.timeoutAlertColor = LCRedColor;
  51. textView.layer.cornerRadius = 8.0;
  52. self.youpaiptextView = textView;
  53. [bgV addSubview:textView];
  54. [textView mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.offset(20.0f);
  56. make.right.offset(-20.0f);
  57. make.top.offset(72.0f);
  58. make.height.offset(96.0f);
  59. }];
  60. UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  61. confirmBtn.layer.cornerRadius = 24.0f;
  62. confirmBtn.clipsToBounds = YES;
  63. [confirmBtn setBackgroundColor:ZYPinkColor];
  64. [confirmBtn setTitle:@"提交" forState:UIControlStateNormal];
  65. [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  66. confirmBtn.titleLabel.font = LCFont(20.0f);
  67. [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
  68. [bgV addSubview:confirmBtn];
  69. [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.offset(40.0f);
  71. make.right.offset(-40.0f);
  72. make.top.equalTo(textView.mas_bottom).offset(35.0f);
  73. make.bottom.offset(-35.0f);
  74. make.height.offset(48.0f);
  75. }];
  76. [self.view layoutIfNeeded];
  77. self.youpaipbgV_y = self.youpaipbgV.mj_y;
  78. }
  79. - (void)youpaifconfirmBtnClick{
  80. if (self.confirmClickBlock) {
  81. self.confirmClickBlock(self.youpaiptextView.textView.text);
  82. }
  83. [self dismissViewControllerAnimated:YES completion:nil];
  84. }
  85. //键盘即将隐藏
  86. - (void)youpaifkeyboardWillHide:(NSNotification *)note{
  87. [self.view layoutIfNeeded];
  88. [UIView animateWithDuration:0.25 animations:^{
  89. self.youpaipbgV.mj_y = self.youpaipbgV_y + 100.0f;
  90. }];
  91. }
  92. //键盘即将弹出
  93. - (void)youpaifkeyboardWillShow:(NSNotification *)note{
  94. [self.view layoutIfNeeded];
  95. [UIView animateWithDuration:0.25 animations:^{
  96. self.youpaipbgV.mj_y = self.youpaipbgV_y - 100.0f;
  97. }];
  98. }
  99. @end