LCAlertView-ObjC 1.0.1

LCAlertView-ObjC 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2016

Maintained by Leo, Leo.



LCAlertView

🍭 Using UIAlertView with Block!

LCAlertView

In me the tiger sniffs the rose.

心有猛虎,细嗅蔷薇。

Welcome to My Blog: http://LeoDev.me

中文介绍

Introduction

Now you could using UIAlertView with Block!

Fascinating? Yeah! So, just star this project now! ⭐️

Installation

LCAlertView is available on CocoaPods. Just add the following to your project Podfile:

pod "LCAlertView-ObjC"  # Podfile

Usage

  • Use by including the following import:

    #import "LCAlertView.h"
  • Demo code:

    // 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];
  • You could also using properties:

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

Example

LCAlertView

LCAlertView

LCAlertView

Release

V 1.0.1

  • Add some quick class methods.

V 1.0.0

  • Initial Commit! First Release! Wonderful Start!

Support

License

MIT License