03-02-UITableView数据刷新
2016-02-15 20:32
459 查看
##效果
##实现
###关键代码
##实现
###关键代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ // 1.取出被点击行对应的模型 YSHero *hero = self.heros[indexPath.row]; // 打印 // NSLog(@"%@",hero.name); // 弹窗,选择类型 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"数据展示" message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; UIAlertAction *defult = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { UITextField *nameField = alert.textFields.firstObject; NSString *name = nameField.text; if ([name isEqualToString:hero.name]) { return ; } // 修改模型数据 hero.name = name; // 局部刷新 [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft ]; // NSLog(@"name - %@ : %d",nameField.text,indexPath.row); }]; [alert addAction:cancel]; [alert addAction:defult]; // 添加输入框 [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.text = hero.name; }]; // 显示对话框 [self presentViewController:alert animated:YES completion:nil]; }
相关文章推荐
- GUI - Web前端开发框架
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 评价ui设计作品好坏的八个标准(界面/交互设计研究)
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- 为Yahoo! UI Extensions Grid增加内置的可编辑器
- Cocos2d-x UI开发之文本类使用实例
- 谈谈对jquery ui tabs 的理解
- 在IE 浏览器中使用 jquery的fadeIn() 效果 英文字符字体加粗
- UI Events 用户界面事件
- jquery UI Datepicker时间控件的使用方法(基础版)
- Hallo.js基于jQuery UI所见即所得的Web编辑器
- 基于jQuery UI CSS Framework开发Widget的经验
- jquery ui 1.7 ui.tabs 动态添加与关闭(按钮关闭+双击关闭)
- jQuery UI设置固定日期选择特效代码分享
- Jquery ajax 同步阻塞引起的UI线程阻塞问题