Badge Notification for iOS

Badge Notification for iOS

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.

You need to log-in or create an account
  • Create an account
  • Log-in
Please use your real name.
Activation link will be sent to this address.
Minimum 8 characters
Enter your password again

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

X

Save your watchlist

Fill your details below to receive project updates from your watch list - including new versions, price changes and discounts.

I agree to the terms of use and privacy policy.

2 licenses, starting from From » $12.99 14 day money-back guarantee View Licenses
or Get a quote

for customization or integration services

  • Very Nice and easy to use component!
    Support is really reactive!
    You can go!
    YB Yannick BOISSEAU
    8 months ago, 0 comments
    Was this helpful?
    Flag
Post a comment

Or enter your name and Email
  • HW Hartmut Wilms License holderApplication License 2 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 Developer 2 years ago
      Sorry. Not sure how that occurred. It should be available as a basic license now.
  • BM barney mills 2 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 Developer 2 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.