Latest 1.0.1
Homepage https://github.com/iTofu/LCAlertView
License MIT
Platforms ios 7.0, requires ARC
Authors

LCAlertView

Travis
CocoaPods
CocoaPods
CocoaPods
LeoDev

🍭 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

Non-CocoaPods Installation

Just drag the LCAlertView folder into your project.

Usage

  • Use by including the following import:

    #import "LCAlertView.h"
  • Demo code:

    • 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);
    }];
    
    [alertView show];
    • 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);
    }];
    
    [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

Latest podspec

{
    "name": "LCAlertView-ObjC",
    "version": "1.0.1",
    "summary": "Using UIAlertView with Block! Support: http://LeoDev.me",
    "homepage": "https://github.com/iTofu/LCAlertView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Leo": "[email protected]"
    },
    "social_media_url": "http://LeoDev.me",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/iTofu/LCAlertView.git",
        "tag": "1.0.1"
    },
    "source_files": "LCAlertView/*",
    "requires_arc": true
}

Pin It on Pinterest

Share This