美文网首页
MaxAlertView_强大的弹框试图

MaxAlertView_强大的弹框试图

作者: 蒋大为 | 来源:发表于2017-03-03 10:41 被阅读48次

【链接】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];
    }

效果图

show_box1.png show_box2.png show_box3.png show_box4.png show_box5.png show_box6.png show_box7.PNG show_box8.PNG show_box9.PNG show_box10.PNG show_box11.PNG show_box12.PNG show_box13.PNG

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章

  • MaxAlertView_强大的弹框试图

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

  • ios常用三方库

    弹框 FFToastGitHub中最强大的iOS Notification和AlertView框架,没有之一! T...

  • 开发

    格式 编辑弹框 删除弹框

  • demo1 动态显示view或弹框 动态隐藏view或弹框

    有一个弹框,弹框上边有一个关闭按钮,点击按钮,可以关闭弹框。点击弹框的周围区域也可以关闭按钮。 点击上边的隐藏弹框...

  • Appium通过相对坐标关闭弹框

    问题:获取不到弹框元素,想点击【不,谢谢】关闭弹框,弹框如下: 解决方法:通过相对坐标关闭弹框。方法如下: 1、获...

  • Swift基础之弹框的应用

    弹框有很多中样式,比如系统的中间弹框,底部弹框还有第三方的MBProgressHuD弹框等等,在本篇文章中小编将带...

  • vue中禁止遮罩底层页面滑动

    方法一:在点击事件(弹出弹框)时,添加 在隐藏弹框时 方法二:在点击事件(弹出弹框)时,添加 在隐藏弹框方法中,添加

  • 简单的文字弹框

    类似系统的弹框,只需一段代码即可调用弹框,还可以修改弹框的样式等 下载

  • react native 弹框设计,兼容IOS和Android

    1.实现的效果 - 点击按钮,出现弹框,最好有动画; - 点击弹框周围,弹框消失; - 点击Android返回键,...

  • iOS常用弹框

    1、系统弹框-底部弹框 UIActionSheet 1、用法 2、举例 如图1:图1.png 2、系统弹框-中间...

网友评论

      本文标题:MaxAlertView_强大的弹框试图

      本文链接:https://www.haomeiwen.com/subject/xcvlgttx.html