// // YOUPAIZYUpdateRemarkWindow.m // VQU // // Created by Elaine on 2020/12/11. // Copyright © 2020 leo. All rights reserved. // #import "YOUPAIZYUpdateRemarkWindow.h" #import "UIViewController+TFPresent.h" #import "YOUPAILZTextView.h" #import "IQKeyboardManager.h" @interface YOUPAIZYUpdateRemarkWindow () @property(nonatomic,strong)UILabel *youpaipnameLabel; @property (nonatomic,strong)YOUPAILZTextView* youpaiptextView; @end @implementation YOUPAIZYUpdateRemarkWindow - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[IQKeyboardManager sharedManager] setEnable:YES]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[IQKeyboardManager sharedManager] setEnable:NO]; } - (void)youpaifgetData{ [LCHttpHelper requestWithURLString:ChatSetting parameters:@{@"user_id":self.youpaipsession.sessionId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 YOUPAILCBaseInfo *baseInfo = [YOUPAILCBaseInfo mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"info"]]; } } failure:^(NSError *error) { }]; } - (void)viewDidLoad { [super viewDidLoad]; // [self.view setFrame:CGRectMake(0, 0, self.vWidth, self.vHeight)]; // CAShapeLayer *maskLayer = [CAShapeLayer layer]; // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:16]; // maskLayer.path = path.CGPath; // self.view.layer.mask = maskLayer; // [self.view setBackgroundColor:[UIColor whiteColor]]; [IQKeyboardManager sharedManager].enableAutoToolbar = NO; // 控制是否显示键盘上的工具条 [IQKeyboardManager sharedManager].keyboardDistanceFromTextField = NavBarHeight; // [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES; _youpaipnameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.vWidth,62)]; _youpaipnameLabel.text = @"修改备注名"; _youpaipnameLabel.textColor = LZ273145Color; _youpaipnameLabel.textAlignment = NSTextAlignmentCenter; _youpaipnameLabel.font = LCBoldFont(19); [self.baseView addSubview:_youpaipnameLabel]; self.baseView.backgroundColor = [UIColor whiteColor]; // UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0,61.5,self.vWidth,0.5)]; // line.backgroundColor = HexColorFromRGB(0xEEEEEE); // [self.baseView addSubview:line]; // UIView* view = [[UIView alloc]initWithFrame:CGRectMake(19,62, self.vWidth-38,self.vHeight - 62 - 75-10)]; // view.backgroundColor = HexColorFromRGB(0x4F4B5B); // view.layer.cornerRadius = 5.0; // view.layer.masksToBounds = YES; // [self.baseView addSubview:view]; YOUPAILZTextView *textView = [[YOUPAILZTextView alloc] initWithMaxCount:10.0f]; textView.frame = CGRectMake(19,62, self.vWidth-38,self.vHeight - 62 - 75-10); textView.youpaiptextViewPadding = UIEdgeInsetsMake(10.0f, 10.0f, 10.0f, 10.0f); textView.youpaiptextLengthDefaultColor = LZA3AABEColor; textView.youpaiptextLengthHigtColor = LZ7C69FEColor; textView.youpaiptextLengthFont = LCFont(14.0f); textView.youpaiptextLengthRight = 10.0f; textView.youpaiptextLengthBottom = 10.0f; textView.youpaiptextView.placeholderFont = LCFont(14.0f); textView.youpaiptextView.placeholderTextColor = LZD3D1D7Color; textView.youpaiptextView.placeholderText = @"请输入备注名…"; textView.youpaiptextView.font = LCFont(14.0f); textView.backgroundColor = LZFAFAFCColor; textView.layer.cornerRadius = 5.0f; textView.clipsToBounds = YES; textView.tintColor = LZ7C69FEColor; [self.baseView addSubview:textView]; textView.youpaiptextView.textColor = LZ273145Color; self.youpaiptextView = textView; UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; cancelBtn.frame = CGRectMake(14,CGRectGetMaxY(textView.frame)+20,(self.vWidth-42)/2.0,48); [cancelBtn addTarget:self action:@selector(youpaifcancelBtnAction) forControlEvents:UIControlEventTouchUpInside]; [cancelBtn setTitle:@"取消" forState:0]; [cancelBtn setTitleColor:LZ273145Color forState:0]; [cancelBtn setBackgroundColor:LZF5F4F7Color]; cancelBtn.layer.cornerRadius = 24; cancelBtn.layer.masksToBounds = YES; cancelBtn.titleLabel.font = LCFont(14); [self.baseView addSubview:cancelBtn]; UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; confirmBtn.frame = CGRectMake(14+(self.vWidth-42)/2.0+14,CGRectGetMaxY(textView.frame)+20,(self.vWidth-42)/2.0,48); [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnAction) forControlEvents:UIControlEventTouchUpInside]; [confirmBtn setTitle:@"确定" forState:0]; [confirmBtn setTitleColor:HexColorFromRGB(0xffffff) forState:0]; [confirmBtn setBackgroundColor:[UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((self.vWidth-42)/2.0, 48) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:1]]]; confirmBtn.layer.cornerRadius = 24; confirmBtn.layer.masksToBounds = YES; confirmBtn.titleLabel.font = LCFont(14); [self.baseView addSubview:confirmBtn]; // [self youpaifgetData]; } -(void)youpaifresignKeyboard{ [self.youpaiptextView resignFirstResponder]; } -(void)youpaifcancelBtnAction { [self TFDismissViewController]; } -(void)youpaifconfirmBtnAction { if (self.youpaiptextView.youpaiptextView.text.length>10) { [ZCHUDHelper showTitle:@"备注长度最多为10个字符"]; }else{ [LCHttpHelper requestWithURLString:UpdateRemark parameters:@{@"user_id":self.youpaipsession.sessionId,@"remark":self.youpaiptextView.youpaiptextView.text} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 [ZCHUDHelper showTitle:[dict objectForKey:@"message"]]; [self TFDismissViewController]; } } failure:^(NSError *error) { }]; } } @end