zoukankan      html  css  js  c++  java
  • UIAlertController

    // 创建弹框控制器
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"请输入团购信息" message:nil preferredStyle:UIAlertControllerStyleAlert];
        
        // 添加按钮
        [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
            // 创建模型
            XMGDeal *deal = [[XMGDeal alloc] init];
            deal.title = [alert.textFields[0] text];
            deal.price = [alert.textFields[1] text];
            [self.deals insertObject:deal atIndex:0];
            
            // 刷新数据
            [self.tableView reloadData];
        }]];
    //    [alert addAction:[UIAlertAction actionWithTitle:@"不知道" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    //        NSLog(@"点击了不知道按钮");
    //    }]];
    //    [alert addAction:[UIAlertAction actionWithTitle:@"不知道2" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    //        NSLog(@"点击了不知道2按钮");
    //    }]];
        
        // 添加文本输入框
        [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
            textField.placeholder = @"请输入团购名字";
        }];
        [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {
            textField.placeholder = @"请输入团购价格";
        }];
        
        // 显示控制器
        [self presentViewController:alert animated:YES completion:nil];
  • 相关阅读:
    WebSQL的基本使用过程
    Windows下Apache2.2+PHP5安装步骤
    DNS解析过程
    MongoDBTemplate多条件查询的问题
    解决Java工程URL路径中含有中文的情况
    Maven配置默认使用的JDK版本
    Mockito when(...).thenReturn(...)和doReturn(...).when(...)的区别
    如何正确对tomcat host进行配置
    对Java动态代理的理解
    对Mybatis的理解
  • 原文地址:https://www.cnblogs.com/jingdizhiwa/p/5613787.html
Copyright © 2011-2022 走看看