zoukankan      html  css  js  c++  java
  • UIAlertView

    - (IBAction)AlertView:(id)sender {
       
        UIAlertView *alerview=[[UIAlertView alloc]initWithTitle:@"提示" message:@"这是一个警告框" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
       
    //    [alerview addButtonWithTitle:@"不确定"];//动态添加子按钮
     
        NSLog(@"%d",alerview.visible);//是否可见
        NSLog(@"%d",alerview.numberOfButtons);//警告框的子按钮的个数
        NSLog(@"%@",[alerview buttonTitleAtIndex:0]);//指定索引的按钮的标题
       
        /**
         * UIAlertViewStyleDefault         基本样式
         *UIAlertViewStyleSecureTextInput  带一个密文输入框
         *UIAlertViewStylePlainTextInput   带一个明文输入框
         *UIAlertViewStyleLoginAndPasswordInput  带有明文+密文样式输入框的警告框

         */
        alerview.alertViewStyle=UIAlertViewStyleLoginAndPasswordInput;
       
        UITextField *loginTF=[alerview textFieldAtIndex:0];//获取登陆的输入框
        UITextField *password=[alerview textFieldAtIndex:1];//密码的输入框
       
        loginTF.placeholder=@"账号";
        password.placeholder=@"密码";
       
       
        [alerview show];
    }

    -(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
    {
    //NSLog(@"警示框已经移除");

    }
    -(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
    {
    //    NSLog(@"警示框将要移除");
    }
    //根据参数buttonIndex来判断点击事件
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
       
        switch (buttonIndex) {
            case 0:
            {
                NSLog(@"取消");
                break;
            }
               case 1:
            {
                NSLog(@"确定");

                break;
               
            }
                case 2:
            {
                NSLog(@"3");

                break;
            }
                case 3:
            {
                NSLog(@"4");

                break;
            }
            default:
                break;
        }
    }
    //按钮组

  • 相关阅读:
    kettle常见问题解决
    kettle 数据库连接中断重置
    笔记本wifi共享给手机 连接连笔记本wifi
    java.sql.SQLException: Io 异常: Connection reset
    ORA-01013:用户请求取消当前的操作
    dubbo 解决Multicast java.net.SocketException: No such device
    linux设置系统日期时间
    dubbo Linux 解决:nc: command not found
    DUBBO本地搭建及小案例
    使用maven编译dubbo,导入eclipse(其他maven开源项目编译类似)
  • 原文地址:https://www.cnblogs.com/shuxiachahu123/p/4989323.html
Copyright © 2011-2022 走看看