name pop
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#import <Masonry/Masonry.h>
|
||||
#import "KBPersonInfoItemCell.h"
|
||||
#import <PhotosUI/PhotosUI.h>
|
||||
#import "LSTPopView.h"
|
||||
#import "KBChangeNicknamePopView.h"
|
||||
|
||||
@interface KBPersonInfoVC () <UITableViewDelegate, UITableViewDataSource, PHPickerViewControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
|
||||
|
||||
@@ -107,7 +109,37 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// 示例:点击昵称/性别执行操作;用户 ID 行点击不处理(有复制按钮)
|
||||
if (indexPath.row == 0) {
|
||||
// TODO: 昵称编辑
|
||||
// 昵称编辑 -> 弹窗
|
||||
CGFloat width = MIN(KB_SCREEN_WIDTH - 48, 360);
|
||||
KBChangeNicknamePopView *content = [[KBChangeNicknamePopView alloc] initWithFrame:CGRectMake(0, 0, width, 230)];
|
||||
content.prefillNickname = self.items.firstObject[@"value"] ?: @"";
|
||||
|
||||
LSTPopView *pop = [LSTPopView initWithCustomView:content
|
||||
parentView:self.view
|
||||
popStyle:LSTPopStyleSmoothFromBottom
|
||||
dismissStyle:LSTDismissStyleScale];
|
||||
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||
pop.hemStyle = LSTHemStyleCenter; // 居中
|
||||
pop.isClickBgDismiss = YES; // 点击背景关闭
|
||||
pop.isAvoidKeyboard = YES; // 规避键盘
|
||||
pop.avoidKeyboardSpace = 10;
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
__weak typeof(pop) weakPop = pop;
|
||||
content.closeHandler = ^{ [weakPop dismiss]; };
|
||||
content.saveHandler = ^(NSString *nickname) {
|
||||
if (nickname.length > 0) {
|
||||
// 更新第一行展示
|
||||
NSMutableArray *m = [weakSelf.items mutableCopy];
|
||||
NSMutableDictionary *d0 = [m.firstObject mutableCopy];
|
||||
d0[@"value"] = nickname; m[0] = d0; weakSelf.items = m;
|
||||
[weakSelf.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
[weakPop dismiss];
|
||||
};
|
||||
|
||||
[pop pop];
|
||||
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: 性别选择
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user