MaxAlertView 强大的弹框试图

【链接】https://github.com/MrJalen/MaxAlertView

MaxAlertView

if (indexPath.section == 0) {
        [MaxAlertView showAlertWithTitle:@"AlertView show Title"];
    }else if (indexPath.section == 1) {
        [MaxAlertView showAlertWithTitle:@"Title" message:@"AlertView show Title with message"];
    }else if (indexPath.section == 2) {
        [MaxAlertView showAlertWithTitle:@"Title" message:@"AlertView show Title with message" cancelTitle:@"cancel" completion:^(BOOL cancelled) {
            NSLog(@"cancel");
        }];
    }else if (indexPath.section == 3) {
        [MaxAlertView showAlertWithTitle:@"Title" message:@"AlertView show Title with message" cancelTitle:@"cancel" otherTitle:@"confirm" completion:^(BOOL cancelled) {
            if (cancelled) {
                NSLog(@"cancel");
            }else {
                NSLog(@"confirm");
            }
        }];
    }else if (indexPath.section == 4) {
        [MaxAlertView showAlertWithTitle:@"Title" message:@"AlertView show Title with message" cancelTitle:@"cancel" otherTitle:@"confirm" contentView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wode_ydy"]] completion:^(BOOL cancelled) {
            if (cancelled) {
                NSLog(@"cancel");
            }else {
                NSLog(@"confirm");
            }
        }];
    }else if (indexPath.section == 5) {
        [MaxAlertView showAlertWithTitle:@"Title" message:@"AlertView show Title with message" completion:^(BOOL cancelled) {
            if (cancelled) {
                NSLog(@"ok");
            }
        }];
    }

AlertPopUpView

if (indexPath.section == 0) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"AlertPopUpView show Title with message"];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
        }];

        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleAlert];
    }else if (indexPath.section == 1) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"AlertPopUpView show Title with More button action style" cancelButtonTitle:@"cancel" otherButtonTitles:@[@"one style", @"two style", @"confirm"] actionWithIndex:^(NSInteger index) {
            if (index == 0) {
                NSLog(@"cancel");
            }else if (index == 1) {
                NSLog(@"one style");
            }else if (index == 2) {
                NSLog(@"two style");
            }else {
                NSLog(@"confirm");
            }
        }];

        [popUpView addBtnWithTitle:@"separate add style" type:JLPopUpBtnStyleDestructive handler:^{
            NSLog(@"separate add style");
        }];

        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleAlert];
    }else if (indexPath.section == 2) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitleConfiguration:^(TitleConfiguration *configuration) {
            configuration.text = @"Title";
            configuration.textColor = [UIColor redColor];
        } messageConfiguration:^(MessageConfiguration *configuration) {
            configuration.text = @"The ways to create the title and the message of the text, font size, font color, text on the bottom margin customizing, adapted to your requirements at any time";
            configuration.fontSize = 15.0;
            configuration.textColor = [UIColor purpleColor];
            configuration.bottom = 25.0;
        }];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"I know" type:JLPopUpBtnStyleDestructive handler:^{
            NSLog(@"I know");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
        }];
        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleAlert];

    }else {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"Log in or Sing in"];
        __weak typeof(PopUpView) *weakPopUpView = popUpView;

        [popUpView addTextFieldWithPlaceholder:@"account/phone number/email" text:nil secureEntry:NO];
        [popUpView addTextFieldWithPlaceholder:@"password" text:nil secureEntry:YES];
        [popUpView addTextFieldWithPlaceholder:@"password again" text:nil secureEntry:YES];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
            for (int i = 0; i < weakPopUpView.textFieldArray.count; i ++) {
                UITextField *tf = weakPopUpView.textFieldArray[i];
                NSLog(@"第%d个输入框的文字是:%@", i, tf.text);
            }
        }];
        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleAlert];
    }

ActionSheetPopUpView

if (indexPath.section == 0) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"AlertPopUpView show Title with message"];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
        }];

        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleActionSheet];
    }else if (indexPath.section == 1) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"AlertPopUpView show Title with More button action style" cancelButtonTitle:@"cancel" otherButtonTitles:@[@"one style", @"two style", @"confirm"] actionWithIndex:^(NSInteger index) {
            if (index == 0) {
                NSLog(@"cancel");
            }else if (index == 1) {
                NSLog(@"one style");
            }else if (index == 2) {
                NSLog(@"two style");
            }else {
                NSLog(@"confirm");
            }
        }];

        [popUpView addBtnWithTitle:@"separate add style" type:JLPopUpBtnStyleDestructive handler:^{
            NSLog(@"separate add style");
        }];

        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleActionSheet];
    }else if (indexPath.section == 2) {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitleConfiguration:^(TitleConfiguration *configuration) {
            configuration.text = @"Title";
            configuration.textColor = [UIColor redColor];
        } messageConfiguration:^(MessageConfiguration *configuration) {
            configuration.text = @"The ways to create the title and the message of the text, font size, font color, text on the bottom margin customizing, adapted to your requirements at any time";
            configuration.fontSize = 15.0;
            configuration.textColor = [UIColor purpleColor];
            configuration.bottom = 25.0;
        }];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"I know" type:JLPopUpBtnStyleDestructive handler:^{
            NSLog(@"I know");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
        }];
        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleActionSheet];
    }else {
        PopUpView *popUpView = [[PopUpView alloc] initWithTitle:@"Title" message:@"Log in or Sing in"];
        __weak typeof(PopUpView) *weakPopUpView = popUpView;

        [popUpView addTextFieldWithPlaceholder:@"account/phone number/email" text:nil secureEntry:NO];
        [popUpView addTextFieldWithPlaceholder:@"password" text:nil secureEntry:YES];
        [popUpView addTextFieldWithPlaceholder:@"password again" text:nil secureEntry:YES];

        [popUpView addBtnWithTitle:@"cancel" type:JLPopUpBtnStyleCancel handler:^{
            NSLog(@"cancel");
        }];

        [popUpView addBtnWithTitle:@"confirm" type:JLPopUpBtnStyleDefault handler:^{
            NSLog(@"confirm");
            for (int i = 0; i < weakPopUpView.textFieldArray.count; i ++) {
                UITextField *tf = weakPopUpView.textFieldArray[i];
                NSLog(@"第%d个输入框的文字是:%@", i, tf.text);
            }
        }];
        [popUpView showInView:self.view preferredStyle:JLPopUpViewStyleActionSheet];
    }

效果图

 

 

版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-25 15:54:00

MaxAlertView 强大的弹框试图的相关文章

考拉Android统一弹框

作者:钱成杰 背景 在快速开发的背景下,经历了n个版本后的考拉Android App中已经存在了各种各样看似相同却各有差别的弹框样式.其中包括系统弹框和自定义弹框,并且在线上时常会出现IllegalArgumentException的异常,而现有的解决方法是通过工具类来保护调用show和dismiss方法,这种方式效率不高,而且覆盖不全,开发过程中容易遗漏.另外现有的Builder方式的弹框构造工具虽然功能强大,能构造各种弹框,但是使用复杂,样式逻辑耦合,使用成本太高.于是,便需要一款样式统一.

layer弹框的上面各个属性 -可配置

<script type="text/javascript"> 12 //eg 13 layer.open({ 14 title:"标题信息提示",//标题信息 15 content: 'test',//内容区域 16 move: false,//是否可以拖动,默认可以拖动 17 btn: ['按钮一', '按钮二', '按钮三'], 18 btn1: function(index){ 19 //按钮[按钮一]的回调 20 layer.close(ind

js弹框3秒后自动消失

开发中有时候会需要最出弹框后,过几秒自动消失的效果,下面给大家分享一下我自己做的一个小案例. 案例中的弹框使用的是bootstrap里面的模态框,实现自动消失则用的是js中的setInterval方法.该弹框使用了jquery-ui中的draggable方法,可拖动. 目录结构如下: 下面是案例代码: demo.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <ti

弹框提示用户输入

在很多页面,都会有提示用户输入账号和密码的弹框.并保障用户的良好体验效果. <html>   <head>   <title></title>   <meta http-equiv="content" content="text/html" charset="utf-8"/>   <style type="text/css">   body{   back

3种常用IOS弹框

目前为止,已经知道3种IOS弹框: 1.系统弹框-底部弹框 UIActionSheet (1)用法:处理用户非常危险的操作,比如注销系统等 (2)举例: UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"确定要注销?" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButton

android如果给TextView或EditText的email链接加下划线,并在点击在email连接上可以弹框显示

如何把textview的一些文字加上背景色: Spannable str = new SpannableString("#fdsfdfsdfdsfd#"); Matcher matcher = getEmailPattern().matcher((CharSequence) str); while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); str.setSpan(new Foregr

未加域客户端使用Lync时反复弹框要求输入凭证

最近发现部分未加域客户端打开Lync 2010时反复弹框要求输入凭证,且提示与Exchange进行连接时凭证错误,此时感觉问题原因因该是发生在两端客户端信息不匹配导致的,此时在Lync客户端帐号登录处输入完整域帐号(帐号@域名)后,并记住密码后无任何报错信息,且退出重新登录也不再提示,outlook相关日历信息也得到了正常同步. 未加域客户端使用Lync时反复弹框要求输入凭证,布布扣,bubuko.com

如果exclipe中Java视图中Consol跑偏了单独形成一个弹框怎么办?

问题如图: 不和其他的在同一窗体中,而且拖动也拖不进去,则是使用以下方法: 点击工具栏上的Window--->点击Reset Perspective...这样就可以解决了. 如果exclipe中Java视图中Consol跑偏了单独形成一个弹框怎么办?,布布扣,bubuko.com

vue弹框,删除元素

1.效果 2.index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"> <title>Ti