Badge Notification for iOS

Badge Notification for iOS

Released 3 years ago , Last update 1 year ago

An easy to use badge template similar to the badges found in UIKit. Fully customizable, self contained, and easy to install. No need for external images. No need to link or import dependent libraries.

iOS only allows badges in two very specific situations. When these are not sufficient, this component will allow you to have badges anywhere in your apps.

Features:

  • Fully customizable fonts, colors, borders, effects, and more.
  • No image files needed (fully self-contained using Core Graphics).
  • Automatic alignment so you don't have to worry about frame dimensions.
  • Only a few lines of code gets you up and running.
  • A thorough How-To Guide and Reference Documentation.
  • Works for both iPhone and iPad.
  • Fully retina display compatible.
  • Can use either strings or integers to set the text inside the badge.
  • Supports both ARC and non-ARC

Installation

To install EZBadgeView, simply drag the EZBadgeView.h and the EZBadgeView.m files to your Xcode project. Be sure to import the EZBadgeView.h file at the top of any class you wish to use it in.

#import "EZBadgeView.h"

Easy Mode

To easily show an EZBadgeView, simply call:

EZBadgeView *badgeView = [[EZBadgeView alloc] init];
badgeView.badgeValue = @"off";
[myView addSubview:badgeView];

How about one that stretches to the right using alignment left:

EZBadgeView *badgeView = [[EZBadgeView alloc] init];
badgeView.badgeAlignment = EZBadgeAlignmentLeft;
badgeView.badgeValue = @"stretches right";
[myView addSubview:badgeView];

This one stretches to the left:

EZBadgeView *badgeView = [[EZBadgeView alloc] init];
badgeView.badgeAlignment = EZBadgeAlignmentRight;
badgeView.badgeValue = @"stretches left";
[myView addSubview:badgeView];

And center:

EZBadgeView *badgeView = [[EZBadgeView alloc] init];
badgeView.badgeAlignment = EZBadgeAlignmentCenter;
badgeView.badgeValue = @"stretches center";
[myView addSubview:badgeView];

How about one that’s aligned with a particular right edge:

EZBadgeView *badgeView = [[EZBadgeView alloc] initWithRightEdge:CGRectGetMaxX(myView.bounds)];
badgeView.badgeValue = @"off";
[myView addSubview:badgeView];

A particular right point:

CGPoint point = CGPointMake(CGRectGetMaxX(myView.bounds), 25.0f);
EZBadgeView *badgeView = [[EZBadgeView alloc] initWithTopRightPoint:point];
badgeView.badgeValue = @"off";
[myView addSubview:badgeView];

Of course you can set the frame to anything you want and it will adhere to any alignment you set:

EZBadgeView *badgeView = [[EZBadgeView alloc] initWithFrame:CGRectMake(32, 19, 0, 0)];
badgeView.badgeValue = @"off";
[myView addSubview:badgeView];

Just need to work with integer values and don’t want to mess with strings?:

EZBadgeView *badgeView = [[EZBadgeView alloc] init];
badgeView.badgeIntValue = 36;
[myView addSubview:badgeView];

Don’t like the fancy shmancy?

EZBadgeView *badgeView = [[EZBadgeView alloc] initWithPlainBackgroundColor:[EZBadgeView classicBlueGrayColor] textColor:[UIColor whiteColor]];
badgeView.badgeValue = @"off";
[myView addSubview:badgeView];

Advanced Features

There are many visual attributes that you can customize:

badgeView.badgeBackgroundColor = [UIColor blueColor];

You can remove all the fancy effects by calling:

[badgeView makePlain];

To reverse, call [badgeView makeFancy];

Other various effects can be customized like so:

badgeView.badgeIntValue = 456;
badgeView.shouldShowShine = NO;
badgeView.shouldShowShadow = YES;
badgeView.shouldShowGradient = NO;
badgeView.shouldShowBorder = YES;
badgeView.badgeBorderWidth = 1.0;
badgeView.badgeBorderColor = [UIColor orangeColor];
badgeView.badgeTextColor = [UIColor brownColor];
badgeView.badgeTextFont = [UIFont fontWithName:@"Arial" size:12.0f];
badgeView.badgeBackgroundColor = [UIColor whiteColor];

See the EZBadgeView Reference for all of the property settings available.

5.0
  • 5 1
  • 4 0
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

$12.99

Application License

  • Perpetual license

  • 1 application

  • Can distribute binary products only

  • Commercial use

  • 6 months support

2 licenses, starting from From » $12.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • HW Hartmut Wilms License holderApplication License
    6 month support
    Purchased on May 25, 2012
    3 years ago
    Hi, price tag states "starting from $ 12.99" so there should be a basic license, right? View pricing shows a developer license, only?
    • Lucid Vapor LLC Publisher 3 years ago
      Sorry. Not sure how that occurred. It should be available as a basic license now.
  • BM barney mills 3 years ago
    Hi... great code thank you.... can you tell me the best way to hide the badge when the value is 0 ...
    • Lucid Vapor LLC Publisher 3 years ago
      Simply set the badgeValue to nil and it should hide. If you're asking how to automatically make a zero value hide the badge, there are probably several ways of doing that. For the most part you could put an "if statement" in an intercepting location that checks for zero, and sets it to nil. Hope that helps.