zoukankan      html  css  js  c++  java
  • 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];
        }

    效果图

      

     


    版权声明:本文为博主原创文章,未经博主允许不得转载。
  • 相关阅读:
    [Java]用于将链表变成字符串并在元素之间插入分隔符的有用函数“String.join”
    Sql语法树示例 select username, ismale from userinfo where age > 20 and level > 5 and 1 = 1
    [Java]一段尚未雕琢的分词代码
    day44_Oracle学习笔记_03
    day43_Oracle学习笔记_02
    WinXP系统中的Oracle数据库如何以管理员身份登录
    Oracle 10G安装指导
    20个Linux服务器性能调优技巧
    Linux 上使用 Gmail SMTP 服务器发送邮件通知
    Netdata Linux下性能实时监测工具
  • 原文地址:https://www.cnblogs.com/MrJalen/p/6813475.html
Copyright © 2011-2022 走看看