Skip to content

dudongdaoqi/LCAlertView

Repository files navigation

LCAlertView

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ios6.0+

Installation

LCAlertView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LCAlertView"

LCAlertView

LCAlertview like the system alertview

  1. uses for iphone and ipad
  2. it can rotate with the screen
  3. like the system alertview, use easy
  4. you can use block style in 2.0
  5. three kinds of animation mode:Default/FlipHorizontal/FlipVertical

This alert provides a alertview like system using ARC model.

Release

1.0 ios4.3 MRC

2.0 ios5.0 ARC

2.1 ios5.0 cocopods

How To Use

#import "LCAlertView.h"

LCAlertView *alert = [[LCAlertView alloc]initWithTitle:@"hello" message:@"are you ready" delegate:self cancelButtonTitle:@"cancle" otherButtonTitles:@"sure",nil];
[alert show]; 

#pragma mark delegate

- (void)alertView:(LCAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"alert:%lu",buttonIndex);
}

Using blocks

LCAlertView *alert = [[LCAlertView alloc]initWithTitle:@"hello" message:@"are you ready" delegate:self cancelButtonTitle:@"cancle" otherButtonTitles:@"yes",nil];
alert.alertAction = ^(NSInteger buttonIndex){
NSLog(@"alert:%lu",buttonIndex);
};
[alert show];

Animation Mode

typedef NS_ENUM(NSInteger, LCAlertAnimation) {
LCAlertAnimationDefault = 0,
LCAlertAnimationFlipHorizontal,
LCAlertAnimationFlipVertical,
};

alert.alertAnimationStyle = LCAlertAnimationFlipHorizontal;

Alert Image

LCAlertView *alert = [[LCAlertView alloc]initWithImage:@"watch_bind" closeImage:@"confirm_delete" delegate:self];
alert.imageAction = ^{
NSLog(@"image tap");
};
alert.alertAction = ^(NSInteger buttonIndex){
NSLog(@"close tap");
};
[alert show];