This commit is contained in:
2025-11-11 15:55:52 +08:00
parent d10114572e
commit 83987db5ac
4 changed files with 307 additions and 5 deletions

View File

@@ -16,6 +16,7 @@
#import <PhotosUI/PhotosUI.h>
#import "LSTPopView.h"
#import "KBChangeNicknamePopView.h"
#import "KBGenderPickerPopView.h"
@interface KBPersonInfoVC () <UITableViewDelegate, UITableViewDataSource, PHPickerViewControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@@ -107,10 +108,9 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// / ID
if (indexPath.row == 0) {
// ->
CGFloat width = MIN(KB_SCREEN_WIDTH - 48, 360);
CGFloat width = KB_SCREEN_WIDTH;
KBChangeNicknamePopView *content = [[KBChangeNicknamePopView alloc] initWithFrame:CGRectMake(0, 0, width, 230)];
content.prefillNickname = self.items.firstObject[@"value"] ?: @"";
@@ -119,7 +119,7 @@
popStyle:LSTPopStyleSmoothFromBottom
dismissStyle:LSTDismissStyleScale];
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
pop.hemStyle = LSTHemStyleCenter; //
pop.hemStyle = LSTHemStyleBottom; //
pop.isClickBgDismiss = YES; //
pop.isAvoidKeyboard = YES; //
pop.avoidKeyboardSpace = 10;
@@ -139,9 +139,39 @@
};
[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) {
// TODO:
// ->
NSArray *genders = @[ @{@"id":@"1",@"name":@"Male"}, @{@"id":@"2",@"name":@"Female"}, @{@"id":@"3",@"name":@"The Third Gender"} ];
CGFloat width = KB_SCREEN_WIDTH;
KBGenderPickerPopView *content = [[KBGenderPickerPopView alloc] initWithFrame:CGRectMake(0, 0, width, 300)];
content.items = genders;
// id
NSString *curName = self.items[1][@"value"];
NSString *selId = nil;
for (NSDictionary *d in genders) { if ([d[@"name"] isEqualToString:curName]) { selId = d[@"id"]; break; } }
content.selectedId = selId;
LSTPopView *pop = [LSTPopView initWithCustomView:content
parentView:nil
popStyle:LSTPopStyleSmoothFromBottom
dismissStyle:LSTDismissStyleSmoothToBottom];
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
pop.hemStyle = LSTHemStyleBottom;
pop.isClickBgDismiss = YES;
__weak typeof(self) weakSelf = self; __weak typeof(pop) weakPop = pop;
content.closeHandler = ^{ [weakPop dismiss]; };
content.saveHandler = ^(NSDictionary *selected) {
NSString *name = selected[@"name"] ?: @"";
NSMutableArray *m = [weakSelf.items mutableCopy];
NSMutableDictionary *d1 = [m[1] mutableCopy];
d1[@"value"] = name; m[1] = d1; weakSelf.items = m;
[weakSelf.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:1 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
[weakPop dismiss];
};
[pop pop];
}
}