fix ui
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user