This commit is contained in:
2025-12-04 15:00:15 +08:00
parent d13bb734b1
commit 1596aac717
2 changed files with 9 additions and 7 deletions

View File

@@ -25,6 +25,9 @@
//
@property (nonatomic, strong) UIButton *saveButton;
/// UIPickerView
@property (nonatomic, assign) NSInteger currentSelectedRow;
@end
@implementation KBGenderPickerPopView
@@ -32,6 +35,7 @@
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.backgroundColor = UIColor.clearColor;
self.currentSelectedRow = 0;
// 使
_items = @[
@{ @"id": @"1", @"name": KBLocalized(@"Male") },
@@ -67,6 +71,7 @@
if (idx != NSNotFound) row = (NSInteger)idx;
}
if (row < (NSInteger)self.items.count) {
self.currentSelectedRow = row;
[self.picker selectRow:row inComponent:0 animated:NO];
}
[self.picker reloadAllComponents];
@@ -151,14 +156,15 @@
}
NSString *name = self.items[row][@"name"] ?: @"";
label.text = name;
BOOL selected = (row == [pickerView selectedRowInComponent:0]);
BOOL selected = (row == self.currentSelectedRow);
label.textColor = selected ? [UIColor colorWithRed:0.02 green:0.75 blue:0.67 alpha:1.0]
: [UIColor colorWithWhite:0.65 alpha:1.0];
return label;
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
//
//
self.currentSelectedRow = row;
[pickerView reloadAllComponents];
}
@@ -216,7 +222,7 @@
return _lineBottom;
}
- (UIView *)makeLine { UIView *v = [UIView new]; v.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1.0]; return v; }
- (UIButton *)saveButton {
if (!_saveButton) {
_saveButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -3,10 +3,6 @@
// keyBoard
//
// Created by Mac on 2025/11/11.
//
//
// KBPersonInfoVC.m
//
//