Coder Social home page Coder Social logo

sunystop / apbanner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appspanel/apbanner

0.0 2.0 0.0 14.55 MB

Simple and customizable iOS in-app notification you can display from wherever you want.

License: MIT License

Ruby 3.49% Objective-C 96.51%

apbanner's Introduction

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

apbanner's People

Contributors

pgapnl avatar

Watchers

James Cloos avatar SSmile avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.