// // YOUPAILZApplyRefundWindow.m // VQU // // Created by CY on 2021/4/29. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZApplyRefundWindow.h" @interface YOUPAILZApplyRefundWindow () @property (nonatomic,weak) ZCLiveTextView *youpaiptextView; @property (nonatomic,assign) CGFloat youpaipbgV_y; @property (nonatomic,weak) UIView *youpaipbgV; @end @implementation YOUPAILZApplyRefundWindow - (void)viewDidLoad { [super viewDidLoad]; self.baseView.hidden = YES; [self youpaifinitUI]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifkeyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youpaifkeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } - (void)youpaifinitUI{ UIView *bgV = [[UIView alloc] init]; bgV.backgroundColor = [UIColor whiteColor]; bgV.layer.cornerRadius = 16.0f; bgV.clipsToBounds = YES; [self.view addSubview:bgV]; self.youpaipbgV = bgV; [bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(32.0f); make.right.offset(-32.0f); make.centerY.equalTo(self.view); }]; UILabel *titleL = [[UILabel alloc] init]; titleL.font = LCBoldFont(19.0f); titleL.textColor = HexColorFromRGB(0x333333); titleL.textAlignment = NSTextAlignmentCenter; titleL.text = @"请输入退款原因"; [bgV addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.offset(30.0f); make.left.offset(14.0f); make.right.offset(-14.0f); }]; ZCLiveTextView* textView = [[ZCLiveTextView alloc]initWithFrame:CGRectMake(20.0f, 72.0f, KScreenWidth-104.0f, 96.0f) TopMargin:5 LeftMargin:14]; textView.backgroundColor = [HexColorFromRGB(0xEEEEEE) colorWithAlphaComponent:0.43f]; textView.textLength = 100; textView.placeholder = @"请输入退款原因…"; textView.placeholderColor = HexColorFromRGB(0x999999); textView.timeoutAlertColor = LCRedColor; textView.layer.cornerRadius = 8.0; self.youpaiptextView = textView; [bgV addSubview:textView]; [textView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(20.0f); make.right.offset(-20.0f); make.top.offset(72.0f); make.height.offset(96.0f); }]; UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; confirmBtn.layer.cornerRadius = 24.0f; confirmBtn.clipsToBounds = YES; [confirmBtn setBackgroundColor:ZYPinkColor]; [confirmBtn setTitle:@"提交" forState:UIControlStateNormal]; [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; confirmBtn.titleLabel.font = LCFont(20.0f); [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside]; [bgV addSubview:confirmBtn]; [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(40.0f); make.right.offset(-40.0f); make.top.equalTo(textView.mas_bottom).offset(35.0f); make.bottom.offset(-35.0f); make.height.offset(48.0f); }]; [self.view layoutIfNeeded]; self.youpaipbgV_y = self.youpaipbgV.mj_y; } - (void)youpaifconfirmBtnClick{ if (self.confirmClickBlock) { self.confirmClickBlock(self.youpaiptextView.textView.text); } [self dismissViewControllerAnimated:YES completion:nil]; } //键盘即将隐藏 - (void)youpaifkeyboardWillHide:(NSNotification *)note{ [self.view layoutIfNeeded]; [UIView animateWithDuration:0.25 animations:^{ self.youpaipbgV.mj_y = self.youpaipbgV_y + 100.0f; }]; } //键盘即将弹出 - (void)youpaifkeyboardWillShow:(NSNotification *)note{ [self.view layoutIfNeeded]; [UIView animateWithDuration:0.25 animations:^{ self.youpaipbgV.mj_y = self.youpaipbgV_y - 100.0f; }]; } @end