• 弹框alertView



    // 创建一个弹框
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@“标题” message:@“显示的具体内容” delegate:self cancelButtonTitle:@“取消” otherButtonTitle:@“确定”,nil];

    // 设置alert的显示类型(这个为message为nil时,输入message内容)
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    // 设置文本框输入的内容
    NSString *text;
    [alert textFiledAtIndex:0].text = text;
    // 展示alert弹框
    [alert show];

    #pragma mark - UIAlertView代理方法
    // 点击alertView上面的按钮就会调用这个方法
    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
    if(buttonIndex == 0)
    {
    // 一般为取消
    return;
    }
    if(buttonIndex == 1)
    {
    // 1.取得文本框里的内容
    NSString *name = [alertView textFieldAtIndex:0].text;
    }
    }
    // 小技巧
    alert.tag 可以用来传一个值,不需要定义全局变量;

  • 相关阅读:
    Linux工具-curl
    常用工具-Postman
    HTTP头部信息
    HTTP状态码
    HTTP/HTTP2协议
    HTTP协议
    常用的服务端口
    三次握手,四次挥手和抓包工具
    路由表
    TCP/IP协议详解
  • 原文地址:https://www.cnblogs.com/shen5214444887/p/4811071.html
Copyright © 2020-2023  润新知