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

  • 相关阅读:
    前端开发和网页设计的过去和未来
    Web开发人员vs网页设计师
    Linux最终将会领先于Windows、Mac OS!
    Linux 大爆炸:一个内核,无数发行版
    因PHP漏洞,超过4.5万个中国网站被攻击
    在 Linux 中自动配置 IPv6 地址
    echart-折线图,数据太多想变成鼠标拖动和滚动的效果?以及数据的默认圈圈如何自定义圆圈的样式
    用TweenMax.js动画让数字动起来
    zrender笔记----(数字Number组件)出现的问题和解决办法
    面试题常考&必考之--js中的数组去重和字符串去重
  • 原文地址:https://www.cnblogs.com/shuxiachahu123/p/4989323.html
Copyright © 2020-2023  润新知