Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
lobianco committed Aug 28, 2013
1 parent 056064c commit 4771734
Showing 1 changed file with 73 additions and 17 deletions.
90 changes: 73 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,47 +49,93 @@ You should use the ```ALAlertBannerManager``` singleton object to manage all ban

```objc
[[ALAlertBannerManager sharedManager] showAlertBannerInView:self.view
style:ALAlertBannerStyleSuccess
position:ALAlertBannerPositionTop
title:@"Success!"
subtitle:@"Here's a banner. Look how easy that was."];
style:ALAlertBannerStyleSuccess
position:ALAlertBannerPositionTop
title:@"Success!"
subtitle:@"Here's a banner. Look how easy that was."];
```
or in a ```UIWindow```:
```objc
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[[ALAlertBannerManager sharedManager] showAlertBannerInView:appDelegate.window
style:ALAlertBannerStyleNotify
position:ALAlertBannerPositionUnderNavBar
title:@"Notify!"
subtitle:@"Here's another banner, and it is nice and comfy in its UIWindow"];
style:ALAlertBannerStyleNotify
position:ALAlertBannerPositionUnderNavBar
title:@"Notify!"
subtitle:@"Here's another banner, and it is nice and comfy in its UIWindow"];
```

A couple notes: ```title``` is limited to one line and will be truncated if necessary. ```subtitle``` can be any number of lines, or it can also be nil. All other parameters should be used however.
A couple notes: ```title``` is limited to one line and will be truncated if necessary. ```subtitle``` can be any number of lines. ```title``` and ```subtitle``` may be nil, but ```style``` and ```position``` should not be nil.

### Other methods of consideration:

```objc
-(void)showAlertBannerInView:(UIView*)view
style:(ALAlertBannerStyle)style
position:(ALAlertBannerPosition)position
title:(NSString*)title
subtitle:(NSString*)subtitle
hideAfter:(NSTimeInterval)secondsToShow;
```

Optional method to set the secondsToShow duration on a per-banner basis.

```objc
-(void)showAlertBannerInView:(UIView*)view
style:(ALAlertBannerStyle)style
position:(ALAlertBannerPosition)position
title:(NSString*)title
subtitle:(NSString*)subtitle
tappedHandler:(void(^)(ALAlertBannerView *alertBanner))tappedBlock;

-(void)showAlertBannerInView:(UIView*)view
style:(ALAlertBannerStyle)style
position:(ALAlertBannerPosition)position
title:(NSString*)title
subtitle:(NSString*)subtitle
hideAfter:(NSTimeInterval)secondsToShow
tappedHandler:(void(^)(ALAlertBannerView *alertBanner))tappedBlock;
```

Optional methods to handle a tap on a banner.

By default, supplying a tap handler will disable ```allowTapToDismiss``` on this particular banner. If you want to reinstate this behavior alongside the tap handler, you can call ```[[ALAlertBannerManager sharedManager] hideAlertBanner:alertBanner];``` in ```tappedBlock()```.

```objc
-(void)hideAlertBanner:(ALAlertBannerView *)alertBanner;
```

Immediately hide a specific alert banner.

```objc
-(NSArray *)alertBannersInView:(UIView*)view;
```

Returns an array of all banners within a certain view.

```objc
-(void)hideAllAlertBanners;
```

Immediately hide all alert banners.
Immediately hides all alert banners in all views.

```objc
-(void)hideAlertBannersInView:(UIView*)view;
```

Immediately hide all alert banners within a specific view.
Immediately hides all alert banners in a certain view.

### Properties
### Global Properties

***Note:*** ALL properties should be set through ```ALAlertBannerManager``` like so:

```objc
[[ALAlertBannerManager sharedManager] setProperty:0.f];
```
Some properties can be set on a per-banner basis by using the appropriate methods in [Example Usage](#example-usage).
***End Note***
---
Expand All @@ -98,27 +144,37 @@ Immediately hide all alert banners within a specific view.
```objc
/**
Length of time in seconds that a banner should show before auto-hiding. Default is 3.5 seconds. A value <= 0 will disable auto-hiding.
Length of time in seconds that a banner should show before auto-hiding.
Default value is 3.5 seconds. A value <= 0 will disable auto-hiding.
*/
@property (nonatomic) NSTimeInterval secondsToShow;
/**
The length of time it takes a banner to transition on-screen. Default is 0.25 seconds.
The length of time it takes a banner to transition on-screen.
Default value is 0.25 seconds.
*/
@property (nonatomic) NSTimeInterval showAnimationDuration;
/**
The length of time it takes a banner to transition off-screen. Default is 0.2 seconds.
The length of time it takes a banner to transition off-screen.
Default value is 0.2 seconds.
*/
@property (nonatomic) NSTimeInterval hideAnimationDuration;
/**
Banner opacity, between 0 and 1. Default value is 0.93f.
Banner opacity, between 0 and 1.
Default value is 0.93f.
*/
@property (nonatomic, assign) CGFloat bannerOpacity;
/**
Tapping on a banner will dismiss it early. Default is YES.
Tapping on a banner will dismiss it early.
Default value is YES. If you supply a tappedHandler in one of the appropriate methods, this will be set to NO for that specific banner.
*/
@property (nonatomic, assign) BOOL allowTapToDismiss;
```
Expand Down

0 comments on commit 4771734

Please sign in to comment.