#import "YOUPAIApplyOutWindow.h" #import "UIViewController+TFPresent.h" #import "YOUPAILZTextView.h" #import "IQKeyboardManager.h" @interface YOUPAIApplyOutWindow () @property(nonatomic,strong)UILabel *youpaipnameLabel; @property (nonatomic,strong)YOUPAILZTextView* youpaiptextView; @end @implementation YOUPAIApplyOutWindow - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[IQKeyboardManager sharedManager] setEnable:YES]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[IQKeyboardManager sharedManager] setEnable:NO]; } - (void)youpaifgetData{ } - (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 = HexColorFromRGB(0xffffff); _youpaipnameLabel.textAlignment = NSTextAlignmentCenter; _youpaipnameLabel.font = LCBoldFont(19); [self.baseView addSubview:_youpaipnameLabel]; self.baseView.backgroundColor = HexColorFromRGB(0x2A2935); // 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:50.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 = HexColorFromRGB(0x6C6B70); textView.youpaiptextLengthHigtColor = ZYPinkColor; textView.youpaiptextLengthFont = LCFont(14.0f); textView.youpaiptextLengthRight = 10.0f; textView.youpaiptextLengthBottom = 10.0f; textView.youpaiptextView.placeholderFont = LCFont(14.0f); textView.youpaiptextView.placeholderTextColor = HexColorFromRGB(0x908E96); textView.youpaiptextView.placeholderText = @"请输入退出原因"; textView.youpaiptextView.font = LCFont(14.0f); textView.backgroundColor = HexColorFromRGB(0x4F4B5B); textView.layer.cornerRadius = 5.0f; textView.clipsToBounds = YES; textView.tintColor = ZYPinkColor; [self.baseView addSubview:textView]; textView.youpaiptextView.textColor = HexColorFromRGB(0xffffff); self.youpaiptextView = textView; textView.backgroundColor = HexColorFromRGB(0x4F4B5B); 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:HexColorFromRGB(0xffffff) forState:0]; [cancelBtn setBackgroundColor:HexColorFromRGB(0x4F4B5B)]; 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:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:1]]]; confirmBtn.layer.cornerRadius = 24; confirmBtn.layer.masksToBounds = YES; confirmBtn.titleLabel.font = LCFont(14); [self.baseView addSubview:confirmBtn]; } -(void)youpaifresignKeyboard{ [self.youpaiptextView resignFirstResponder]; } -(void)youpaifcancelBtnAction { [self TFDismissViewController]; } -(void)youpaifconfirmBtnAction { if (self.youpaiptextView.youpaiptextView.text.length>50) { [ZCHUDHelper showTitle:@"备注长度最多为50个字符"]; }else{ [self TFDismissViewController]; if (self.DidlickSureBlock) { self.DidlickSureBlock(self.youpaiptextView.youpaiptextView.text); } } } @end