• UIAlertController iOS9


    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
        //取出模型
        CarGroup * group = self.dataArray[indexPath.section];
        
        carModel * model = group.cars[indexPath.row];
        //初始化提示框;
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:model.name message:@"修改成"preferredStyle: UIAlertControllerStyleAlert];
        //alert View 添加文本输入框
        [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
            //textFiled的文本内容
            textField.text = model.name;
        }];
        //添加第二个文本
        [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
            textField.text = group.title;
        }];
        //添加确定按钮,附带监听操作
        [alert addAction:[UIAlertAction actionWithTitle:@"确定修改" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
            
            //点击按钮的响应事件;
            //取出数组中对应的textFiled
          UITextField * textField = alert.textFields.firstObject;
            //赋值
            model.name = textField.text;
            //取出点击的cell的行号,和组号,点击了哪一个cell
            NSIndexPath  *path = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
            //刷新选中cell的数据,附带动画
            [self.tabbleView reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationTop];
    
        }]];
            //添加取消按钮
        [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件;
            
            
        }]];
        
        //弹出提示框;点击后显示弹框
        [self presentViewController:alert animated:true completion:nil];
    }

  • 相关阅读:
    开源.NET FTP组件edtFTPnet 用法
    C#开发的较好的FTP类
    C# 配置文件读取与修改
    对于List的All,Any,Where,FirstOrDefault,Average,Sum,Distinct,Union,AddRange,RemoveRange,InsertRange,GetRange操作
    一次性打印多个C1FlexGrid
    Word自动生成目录页码靠右对齐
    Windows Workflow学习文档
    Windows Workflow开发演练
    Boo who
    Missing letters
  • 原文地址:https://www.cnblogs.com/LDSmallCat/p/5082665.html
Copyright © 2020-2023  润新知