// // LZPickerWindow.m // MEISHI // // Created by CY on 2021/1/25. // Copyright © 2021 leo. All rights reserved. // #import "LZPickerWindow.h" #import "UIViewController+TFPresent.h" #import "PGPickerView.h" @interface LZPickerWindow () @end @implementation LZPickerWindow - (void)viewDidLoad { [super viewDidLoad]; self.baseView.hidden = YES; [self youpaifinitUI]; } - (void)youpaifinitUI{ UIView *bgV = [[UIView alloc] init]; bgV.backgroundColor = HexColorFromRGB(0x2A2935); bgV.layer.cornerRadius = 10.0f; bgV.clipsToBounds = YES; [self.view addSubview:bgV]; [bgV mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.offset(10.0f); make.left.offset(0.0f); make.right.offset(0.0f); make.height.offset(226.0f + SafeHeight + 10.0f); }]; UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; [cancelBtn setTitleColor:HexColorFromRGB(0x9F9DA5) forState:UIControlStateNormal]; cancelBtn.titleLabel.font = LCFont15; [cancelBtn addTarget:self action:@selector(cancelBtnClick) forControlEvents:UIControlEventTouchUpInside]; [bgV addSubview:cancelBtn]; [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(32.0f); make.top.offset(0.0f); make.height.offset(51.0f); }]; UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [confirmBtn setTitle:@"确认" forState:UIControlStateNormal]; [confirmBtn setTitleColor:HexColorFromRGB(0xF4003F) forState:UIControlStateNormal]; confirmBtn.titleLabel.font = LCFont15; [confirmBtn addTarget:self action:@selector(confirmBtnClick) forControlEvents:UIControlEventTouchUpInside]; [bgV addSubview:confirmBtn]; [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-32.0f); make.top.offset(0.0f); make.height.offset(51.0f); }]; UIView *line = [[UIView alloc] init]; line.backgroundColor = HexColorFromRGB(0x4F4B5B); [bgV addSubview:line]; [line mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.offset(0.0f); make.height.offset(0.5f); make.top.equalTo(confirmBtn.mas_bottom); }]; self.pickerView = [[PGPickerView alloc] initWithFrame:CGRectMake(0, 51.5f, KScreenWidth, 226.0f - 51.5f)]; // pickerView.delegate = self; // pickerView.dataSource = self; self.pickerView.type = PGPickerViewLineTypeline; self.pickerView.lineBackgroundColor = [UIColor clearColor]; self.pickerView.lineHeight = 0.0f; self.pickerView.verticalLineBackgroundColor = [UIColor clearColor]; self.pickerView.verticalLineWidth = 0.0f; self.pickerView.backgroundColor = [UIColor clearColor]; self.pickerView.isHiddenMiddleText = YES; self.pickerView.rowHeight = 35; self.pickerView.middleTextColor = [[UIColor whiteColor] colorWithAlphaComponent:0.2f]; self.pickerView.textColorOfSelectedRow = [UIColor whiteColor]; self.pickerView.textColorOfOtherRow = [[UIColor whiteColor] colorWithAlphaComponent:0.2f]; self.pickerView.textFontOfSelectedRow = LCFont(17); self.pickerView.textFontOfOtherRow = LCFont(17); self.pickerView.lineBackgroundColor = [UIColor clearColor]; self.pickerView.delegate = self; [bgV addSubview:self.pickerView]; } - (void)cancelBtnClick{ [self TFDismissViewController]; } - (void)confirmBtnClick{ if (self.delegate && [self.delegate respondsToSelector:@selector(confirmClick)]) { [self.delegate confirmClick]; } [self TFDismissViewController]; } @end