Skip to content

mehulgecg/NotificationManager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NotificationManager

NotificationManager is a stand-alone class that can be used to display notifications to the user similar to the Game Center notifications, but with more features.

Features

  • Adjusts to any device orientation
  • Customizable duration and several other parameters
  • Supports custom icon
  • Multi-line text
  • 2 different styles: Slide-In and Fade-In
  • Supported on iPhone and iPad with iOS 3.2 onwards

Installation

  1. Add the QuartzCore Framework to your Xcode project

  2. Add the following files to your Xcode project (make sure to select Copy Items in the dialog):

  • NotificationManager.h
  • NotificationManager.m
  1. Import the NotificationManager.h file

Usage

Display a text-only notification:

    [[NotificationManager defaultManager] notifyText:@"This is a notification."
                                           withStyle:NotificationStyleSlideIn];

Display a notification with specified icon:

    [[NotificationManager defaultManager] notifyText:@"This is a notification with an icon."
                                            withIcon:@"icon_info.png"
                                           withStyle:NotificationStyleSlideIn];

Display notification using Fade-In style:

    [[NotificationManager defaultManager] notifyText:@"This is a fade-in notification."
                                           withStyle:NotificationStyleFadeIn];

Display notification with custom duration:

    [[NotificationManager defaultManager] notifyText:@"This notification is taking too long."
                                           withStyle:NotificationStyleFadeIn
                                         forDuration:5];

Separate your text with /n to use multi-line notifications:

    [[NotificationManager defaultManager] notifyText:@"This is the first line./nThis is the second line"
                                           withStyle:NotificationStyleSlideIn];

Force a notification to any orientation:

    [[NotificationManager defaultManager] notifyText:@"This notification is for Landscape (Left) orientation"
                                           withStyle:NotificationStyleFadeIn 
                                    forceOrientation:UIInterfaceOrientationLandscapeLeft];

Customization

To customize the look of the notifications, open the NotificationManager.h file and change the defined constants to alter the font, size and colors.

About

iOS singleton to display notifications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published