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];
    }

效果图

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

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,641评论 25 708
  • 总是感觉工作和生活不如意,一有烦心事我就会像朋友诉苦,有时候孤独无助的时候有个人愿意听你诉说,在倾诉的时候...
    evergreenbec阅读 442评论 0 0
  • 风风光光方法个
    dfb3f7094e08阅读 143评论 0 0
  • 所幸·遇见 作者:木禾 加班到中午,顶着大太阳回家,心生一丝丝不满,不免自怨自艾,怪自己该学习的时候不好好学习,怪...
    珅墨阅读 293评论 0 1
  • 工作中又或者生活中 激情算什么?热情又是什么? 我茫然过……也激情过…… 曾经以为会每天热情于生活和工作 哪怕累了...
    立正敬礼阅读 194评论 0 1