Latest 1.0.5
Homepage https://github.com/appspanel/APBanner
License MIT
Platforms ios 8.0
Authors

APBanner by AppsPanel (APNL)

alt text

APBanner is a simple and customizable iOS in-app notification you can display from wherever you want.

This lib can :

  • Display title, subtitle and body
  • Display auto resizable image
  • Auto expand-collapse with user’s gestures

Getting Started

1 – Install

APBanner is available on cocoapods.

$ pod 'APBanner'

2 – Import

Add this import where you want to display banner. You can use it in a ViewController, or wherever you want.

#import <APBanner/APBannerManager.h>

3 – Use

Simple manager option

There are three static methods in APBannerManager to show banner. One with only a title, another with only title and image, and the last one with title, subtitle, body and image.

Each parameter is optionnal. The last paramameter is a completion block to catch user’s action on this banner (i.e. Single tap and dismiss).

Use it as following :

    [APBannerManager showBannerWithTitle:@"Title"
                                          subtitle:@"Subtitle"
                                          body:@"Body"
                                          image:[UIImage imageNamed:@"myPicture"]
                                          actionBlock:^(APBannerActionType type) {
                                            switch (type) {
                                              case APBannerActionTypeTap:
                                                NSLog(@"TAP");
                                                break;
                                              case APBannerActionTypeDismiss:
                                                NSLog(@"DISMISS");
                                                break;
                                            }
                                          }];
Own management

If you don’t want to use the manager, you can init banners by yourself, as following :

    APBanner *myBanner = [[APBanner alloc]  initWithTitle:@"title" 
                                            subtitle:@"subtitle" 
                                            body:@"body" 
                                            image:[UIImage imageNamed:@"myPicture"]] 
                                            actionBlock:^(APBannerActionType type) {
                                            switch (type) {
                                              case APBannerActionTypeTap:
                                                NSLog(@"TAP");
                                                break;
                                              case APBannerActionTypeDismiss:
                                                NSLog(@"DISMISS");
                                                break;
                                            }
                                          }];
    [myBanner show];

4 – Customization

You can customize all futures banners by using static properties on APBannerManager, or customize only one using APBanner’s properties by instantiate it by yourself.

Properties are following :

  • NSString *title
  • NSString *subtitle
  • NSString *body
  • UIImage *image
  • NSNumber *duration
  • UIBlurEffectStyle blurEffectStyle
  • UIColor *backgroundColor
  • UIColor *titleColor
  • UIColor *subTitleColor
  • UIColor *bodyColor
  • UIFont *titleFont
  • UIFont *subtitleFont
  • UIFont *bodyFont

For example, if you want all futures title’s color to red, do :

[APBannerManager setTitleColor:[UIColor redColor]];

5 – Demo

You can find a demo project inside Examples folder.

Have a problem ?

Feel free to contact us on : [email protected]

Resources

Latest podspec

{
    "name": "APBanner",
    "platforms": {
        "ios": "8.0"
    },
    "version": "1.0.5",
    "summary": "APBanner is a simple and customizable iOS in-app notification you can display from wherever you want.",
    "description": "This lib can :n  - Display title, subtitle and bodyn  - Display auto resizable imagen  - Auto expand-collapse with user's gestures",
    "homepage": "https://github.com/appspanel/APBanner",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Pierre Grimault": "[email protected]"
    },
    "source": {
        "git": "https://github.com/appspanel/APBanner.git",
        "tag": "1.0.5"
    },
    "resources": "APBanner/Classes/**/*.{xib,nib,png,bundle}",
    "source_files": "APBanner/Classes/**/*.{h,m}"
}

Pin It on Pinterest

Share This