LCAlertView-ObjC 1.0.1

LCAlertView-ObjC 1.0.1

测试已测试
语言 Obj-CObjective C
许可 MIT
发布最后发布2016年4月

LeoLeo 维护。



LCAlertView

🍭使用 UIAlertView 结合 Block!

LCAlertView

In me the tiger sniffs the rose.

心有猛虎,细嗅蔷薇。

欢迎来到 我的博客http://LeoDev.me

中文介绍

介绍

现在您可以使用 UIAlertView 结合 Block!

令人惊奇是吧!是的,所以现在就 star 这个项目吧!⭐️

安装

LCAlertView 可在 CocoaPods 上使用。只需将以下内容添加到您的项目 Podfile 中

pod "LCAlertView-ObjC"  # Podfile

使用

  • 通过包含以下导入使用:

    #import "LCAlertView.h"
  • 演示代码

    // 1. Class method
    LCAlertView *alertView = [LCAlertView title:@"LCAlertView" message:@"Quick Method" cancelButtonTitle:@"Cancel" otherButtonTitles:@[@"1", @"2"] clickedButtonAtIndex:^(LCAlertView *alertView, NSInteger buttonIndex) {
        NSLog(@"clickedButtonAtIndex: %d", (int)buttonIndex);
    }];
    
    // 2. Instance method
    LCAlertView *alertView = [[LCAlertView alloc] initWithTitle:@"LCAlertView" message:@"Quick Method" cancelButtonTitle:@"Cancel" otherButtonTitles:@[@"1", @"2", @"3"] clickedButtonAtIndex:^(LCAlertView *alertView, NSInteger buttonIndex) {
        NSLog(@"clickedButtonAtIndex: %d", (int)buttonIndex);
    }];
    
    // show alertView
    [alertView show];
  • 您也可以使用属性

    LCAlertView *alertView = [[LCAlertView alloc] initWithTitle:@"LCAlertView" message:@"Block Properties" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"1", @"2", @"3", nil];
    
    alertView.clickedButtonAtIndexBlock = ^(LCAlertView *alertView, NSInteger buttonIndex) {
        NSLog(@"clickedButtonAtIndex: %d", (int)buttonIndex);
    };
    
    alertView.cancelBlock = ^(LCAlertView *alertView) {
        NSLog(@"cancel");
    };
    
    // You should set `willPresentAlertViewBlock` before `- (void)show;`
    // 设置 willPresentAlertViewBlock 一定要放在 `- (void)show;`方法之前
    alertView.willPresentAlertViewBlock = ^(LCAlertView *alertView) {
        NSLog(@"willPresentAlertView");
    };
    
    alertView.didPresentAlertViewBlock = ^(LCAlertView *alertView) {
        NSLog(@"didPresentAlertView");
    };
    
    alertView.willDismissWithButtonIndexBlock = ^(LCAlertView *alertView, NSInteger buttonIndex) {
        NSLog(@"willDismissWithButtonIndexBlock: %d", (int)buttonIndex);
    };
    
    alertView.didDismissWithButtonIndexBlock = ^(LCAlertView *alertView, NSInteger buttonIndex) {
        NSLog(@"didDismissWithButtonIndex: %d", (int)buttonIndex);
    };
    
    [alertView show];

示例

LCAlertView

LCAlertView

LCAlertView

版本

版本 1.0.1

  • 添加了一些快速类方法。

版本 1.0.0

  • 首次提交!首次发布!良好的开端!

支持

许可

MIT 许可证