This commit is contained in:
2025-12-04 14:26:22 +08:00
parent b8f8d2e6b0
commit cffd77eeb5
2 changed files with 31 additions and 7 deletions

View File

@@ -32,11 +32,11 @@
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) { if (self = [super initWithFrame:frame]) {
self.backgroundColor = UIColor.clearColor; self.backgroundColor = UIColor.clearColor;
// // 使
_items = @[ _items = @[
@{ @"id": @"1", @"name": @"Male" }, @{ @"id": @"1", @"name": KBLocalized(@"Male") },
@{ @"id": @"2", @"name": @"Female" }, @{ @"id": @"2", @"name": KBLocalized(@"Female") },
@{ @"id": @"3", @"name": @"The Third Gender" }, @{ @"id": @"3", @"name": KBLocalized(@"The Third Gender") },
]; ];
[self buildUI]; [self buildUI];
[self makeConstraints]; [self makeConstraints];

View File

@@ -49,6 +49,9 @@
self.kb_navView.backgroundColor = [UIColor clearColor]; self.kb_navView.backgroundColor = [UIColor clearColor];
self.view.backgroundColor = [UIColor colorWithHex:0xF8F8F8]; self.view.backgroundColor = [UIColor colorWithHex:0xF8F8F8];
// gender
NSString *genderText = [self kb_genderDisplayText];
// //
// self.items = @[ // self.items = @[
// @{ @"title": KBLocalized(@"Nickname"), @"value": @"", @"arrow": @YES, @"copy": @NO }, // @{ @"title": KBLocalized(@"Nickname"), @"value": @"", @"arrow": @YES, @"copy": @NO },
@@ -57,7 +60,7 @@
// ]; // ];
self.items = @[ self.items = @[
@{ @"title": KBLocalized(@"Nickname"), @"value": self.userModel.nickName, @"arrow": @YES, @"copy": @NO }, @{ @"title": KBLocalized(@"Nickname"), @"value": self.userModel.nickName, @"arrow": @YES, @"copy": @NO },
@{ @"title": KBLocalized(@"Gender"), @"value": @"Choose", @"arrow": @YES, @"copy": @NO }, @{ @"title": KBLocalized(@"Gender"), @"value": genderText, @"arrow": @YES, @"copy": @NO },
@{ @"title": KBLocalized(@"User ID"), @"value": self.userModel.userId, @"arrow": @NO, @"copy": @YES }, @{ @"title": KBLocalized(@"User ID"), @"value": self.userModel.userId, @"arrow": @NO, @"copy": @YES },
]; ];
@@ -91,6 +94,23 @@
self.modifyLabel.text = userModel.nickName; self.modifyLabel.text = userModel.nickName;
} }
/// userModel.gender
- (NSString *)kb_genderDisplayText {
if (!self.userModel) {
return KBLocalized(@"Choose");
}
switch (self.userModel.gender) {
case UserSexMan:
return KBLocalized(@"Male");
case UserSexWeman:
return KBLocalized(@"Female");
case UserSexTwoSex:
return KBLocalized(@"The Third Gender");
default:
return KBLocalized(@"Choose");
}
}
#pragma mark - UITableView #pragma mark - UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
@@ -154,8 +174,12 @@
[pop pop]; [pop pop];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [content focusInput]; }); // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [content focusInput]; });
} else if (indexPath.row == 1) { } else if (indexPath.row == 1) {
// -> // ->
NSArray *genders = @[ @{@"id":@"1",@"name":@"Male"}, @{@"id":@"2",@"name":@"Female"}, @{@"id":@"3",@"name":@"The Third Gender"} ]; NSArray *genders = @[
@{@"id":@"1",@"name":KBLocalized(@"Male")},
@{@"id":@"2",@"name":KBLocalized(@"Female")},
@{@"id":@"3",@"name":KBLocalized(@"The Third Gender")},
];
CGFloat width = KB_SCREEN_WIDTH; CGFloat width = KB_SCREEN_WIDTH;
KBGenderPickerPopView *content = [[KBGenderPickerPopView alloc] initWithFrame:CGRectMake(0, 0, width, 300)]; KBGenderPickerPopView *content = [[KBGenderPickerPopView alloc] initWithFrame:CGRectMake(0, 0, width, 300)];
content.items = genders; content.items = genders;