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;
        }
    }
    //按钮组

  • 相关阅读:
    [LeetCode] 55. Jump Game 跳跃游戏
    [LeetCode] 163. Missing Ranges 缺失区间
    [LeetCode] 228. Summary Ranges 总结区间
    获取当时时间和日期
    响应式布局设备分界点
    html5shiv.js分析-读源码之javascript系列
    建站模板开源代码
    js 调试问题
    transform使用参考指南
    浏览器版本过低
  • 原文地址:https://www.cnblogs.com/shuxiachahu123/p/4989323.html
Copyright © 2011-2022 走看看