zoukankan      html  css  js  c++  java
  • 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];
    }

  • 相关阅读:
    arthas-常用命令
    k8s-容器技术-Mount Namespace
    k8s-statefulset介绍
    k8s-yaml配置文件
    k8s-控制器模式
    k8s-pod使用
    k8s-pod简介(半原创)
    k8s-安装我们第一个集群
    k8s-安装
    Corn表达式详解(转)
  • 原文地址:https://www.cnblogs.com/LDSmallCat/p/5082665.html
Copyright © 2011-2022 走看看