LZPickerWindow.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // LZPickerWindow.m
  3. // MEISHI
  4. //
  5. // Created by CY on 2021/1/25.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "LZPickerWindow.h"
  9. #import "UIViewController+TFPresent.h"
  10. #import "PGPickerView.h"
  11. @interface LZPickerWindow ()
  12. @end
  13. @implementation LZPickerWindow
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. self.baseView.hidden = YES;
  17. [self youpaifinitUI];
  18. }
  19. - (void)youpaifinitUI{
  20. UIView *bgV = [[UIView alloc] init];
  21. bgV.backgroundColor = HexColorFromRGB(0x2A2935);
  22. bgV.layer.cornerRadius = 10.0f;
  23. bgV.clipsToBounds = YES;
  24. [self.view addSubview:bgV];
  25. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.bottom.offset(10.0f);
  27. make.left.offset(0.0f);
  28. make.right.offset(0.0f);
  29. make.height.offset(226.0f + SafeHeight + 10.0f);
  30. }];
  31. UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  32. [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
  33. [cancelBtn setTitleColor:HexColorFromRGB(0x9F9DA5) forState:UIControlStateNormal];
  34. cancelBtn.titleLabel.font = LCFont15;
  35. [cancelBtn addTarget:self action:@selector(cancelBtnClick) forControlEvents:UIControlEventTouchUpInside];
  36. [bgV addSubview:cancelBtn];
  37. [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.offset(32.0f);
  39. make.top.offset(0.0f);
  40. make.height.offset(51.0f);
  41. }];
  42. UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  43. [confirmBtn setTitle:@"确认" forState:UIControlStateNormal];
  44. [confirmBtn setTitleColor:HexColorFromRGB(0xF4003F) forState:UIControlStateNormal];
  45. confirmBtn.titleLabel.font = LCFont15;
  46. [confirmBtn addTarget:self action:@selector(confirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
  47. [bgV addSubview:confirmBtn];
  48. [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.right.offset(-32.0f);
  50. make.top.offset(0.0f);
  51. make.height.offset(51.0f);
  52. }];
  53. UIView *line = [[UIView alloc] init];
  54. line.backgroundColor = HexColorFromRGB(0x4F4B5B);
  55. [bgV addSubview:line];
  56. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.right.offset(0.0f);
  58. make.height.offset(0.5f);
  59. make.top.equalTo(confirmBtn.mas_bottom);
  60. }];
  61. self.pickerView = [[PGPickerView alloc] initWithFrame:CGRectMake(0, 51.5f, KScreenWidth, 226.0f - 51.5f)];
  62. // pickerView.delegate = self;
  63. // pickerView.dataSource = self;
  64. self.pickerView.type = PGPickerViewLineTypeline;
  65. self.pickerView.lineBackgroundColor = [UIColor clearColor];
  66. self.pickerView.lineHeight = 0.0f;
  67. self.pickerView.verticalLineBackgroundColor = [UIColor clearColor];
  68. self.pickerView.verticalLineWidth = 0.0f;
  69. self.pickerView.backgroundColor = [UIColor clearColor];
  70. self.pickerView.isHiddenMiddleText = YES;
  71. self.pickerView.rowHeight = 35;
  72. self.pickerView.middleTextColor = [[UIColor whiteColor] colorWithAlphaComponent:0.2f];
  73. self.pickerView.textColorOfSelectedRow = [UIColor whiteColor];
  74. self.pickerView.textColorOfOtherRow = [[UIColor whiteColor] colorWithAlphaComponent:0.2f];
  75. self.pickerView.textFontOfSelectedRow = LCFont(17);
  76. self.pickerView.textFontOfOtherRow = LCFont(17);
  77. self.pickerView.lineBackgroundColor = [UIColor clearColor];
  78. self.pickerView.delegate = self;
  79. [bgV addSubview:self.pickerView];
  80. }
  81. - (void)cancelBtnClick{
  82. [self TFDismissViewController];
  83. }
  84. - (void)confirmBtnClick{
  85. if (self.delegate && [self.delegate respondsToSelector:@selector(confirmClick)]) {
  86. [self.delegate confirmClick];
  87. }
  88. [self TFDismissViewController];
  89. }
  90. @end