• Stars
    star
    942
  • Rank 48,525 (Top 1.0 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An iOS UIView for presenting a minimalistic notification that doesn't block the UI and is highly configurable.

JFMinimalNotification

This is an iOS UIView for presenting a beautiful notification that is highly configurable and works for both iPhone and iPad. JFMinimalNotification is only available in ARC and targets iOS 7.0+.

CocoaPods CocoaPods CocoaPods CocoaPods CocoaPods

Looking for an Android version? Garrett Franks created one and it's awesome, check it out: https://github.com/gfranks/GFMinimalNotifications

What It Looks Like:

Example Example

See a short video of this control here: https://www.youtube.com/watch?v=jDYC-NYKl9A

Screen Shots

Examples

Installation:

CocoaPods

pod 'JFMinimalNotifications', '~> 0.0.8'

Directly include source into your projects

  • Simply copy the source files from the "JFMinimalNotification" folder into your project.
  • In your application's project app target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block and click the "+" button and select the "CoreGraphics.framework".

How To Use It:

Basic Example

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    /**
     * Create the notification
     */
    self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleDefault title:@"This is my awesome title" subTitle:@"This is my awesome sub-title"];
    
    /**
     * Set the desired font for the title and sub-title labels
     * Default is System Normal
     */
    UIFont* titleFont = [UIFont fontWithName:@"STHeitiK-Light" size:22];
    [self.minimalNotification setTitleFont:titleFont];
    UIFont* subTitleFont = [UIFont fontWithName:@"STHeitiK-Light" size:16];
    [self.minimalNotification setSubTitleFont:subTitleFont];

    /**
     * Set any necessary edge padding as needed
     */
    self.minimalNotification.edgePadding = UIEdgeInsetsMake(0, 0, 10, 0);

    /**
     * Add the notification to a view
     */
    [self.view addSubview:self.minimalNotification];
}

/**
 * Showing the notification from a button handler
 */
- (IBAction)show:(id)sender {
    [self.minimalNotification show];
}

/**
 * Hiding the notification from a button handler
 */
- (IBAction)dismiss:(id)sender {
    [self.minimalNotification dismiss];
}

Constructors / Options

/**
 * Note: passing a dismissalDelay of 0 means the notification will NOT be automatically dismissed, you will need to 
 * dismiss the notification yourself by calling -dismiss on the notification object. If you pass a dismissalDelay 
 * value greater than 0, this will be the length of time the notification will remain visisble before being 
 * automatically dismissed.
 */
 
// With dismissalDelay
self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleError title:@"This is my awesome title" subTitle:@"This is my awesome sub-title" dismissalDelay:3.0];
 
// Without dismissalDelay and with touchHandler
self.minimalNotification = [JFMinimalNotification notificationWithStyle:JFMinimalNotificationStyleError title:@"This is my awesome title" subTitle:@"This is my awesome sub-title" dismissalDelay:0.0 touchHandler:^{
    [self.minimalNotification dismiss];
}];
// Available Styles
typedef NS_ENUM(NSInteger, JFMinimalNotificationStyle) {
    JFMinimalNotificationStyleDefault,
    JFMinimalNotificationStyleError,
    JFMinimalNotificationStyleSuccess,
    JFMinimalNotificationStyleInfo,
    JFMinimalNotificationStyleWarning,
    
    /**
     * @return Used to get a title and subtitle, no accessory views, and white bg with black label text. Use the .bakgroundColor property on the notification to set the desired background color and .textColor property on the titleLabel and subTitleLabel UILabel's to change text color.
     */
    JFMinimalNotificationStyleCustom,
    
    /**
     * @return A dark blur with vibrancy effect in the bakground with white label text.
     */
    JFMinimalNotificationStyleBlurDark,
    
    /**
     * @return A light blur with vibrancy effect in the bakground with black label text.
     */
    JFMinimalNotificationStyleBlurLight
};

Please see the example project include in this repo for an example of how to use this notification.

Delegate Methods:

- (void)minimalNotificationWillShowNotification:(JFMinimalNotification*)notification;
- (void)minimalNotificationDidShowNotification:(JFMinimalNotification*)notification;
- (void)minimalNotificationWillDisimissNotification:(JFMinimalNotification*)notification;
- (void)minimalNotificationDidDismissNotification:(JFMinimalNotification*)notification;

License

Copyright (c) 2012 Jeremy Fox (jeremyfox.me). All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

JFCardSelectionViewController

A fancy collection style view controller
Swift
431
star
2

JFDepthView

iOS project for presenting views with a 3D effect to add depth
Objective-C
268
star
3

ios_build_scripts

Build scripts that can be used to update build # and upload binary to Fabric/HockeyApp as well as post notifications into Slack/HipChat from an Xcode Bot
Shell
22
star
4

PhotoMojo

PhotoMojo is a very simple Android application for editing photos from the Camera or Gallery
Java
14
star
5

PriorityQueue-ObjC

A PriorityQueue for Objective-C/iOS Developers
Objective-C
8
star
6

pivotal-tracker-api

This is a Ruby Gem that can be used to communicate with the Pivotal Tracker API v5
Ruby
7
star
7

Stylus.mode

Stylus color mode for Coda
7
star
8

JFTransporter

An Objective-C Networking abstraction to help make setting up a service layer in an iOS app much quicker and easier
Objective-C
4
star
9

NotificationQueue

An iOS library used to handle queuing and scheduling of notifications for presentation by registered notification handlers
Swift
3
star
10

PetFinderAPI

Pet Finder API iOS Framework
HTML
2
star
11

HTTPService

An HTTP Networking Service written in Swift
Swift
2
star
12

Ultimate-Notifications

Module for showing kick ass notifications in a Titanium Mobile application!
Python
2
star
13

android-analytics

A lightweight framework for abstracting analytics code and wrapping analytics providers
Kotlin
2
star
14

demo_app

Ruby on Rails demo application
Ruby
1
star
15

iOS-Slider

Objective-C
1
star
16

billplanner-cloudant

Billplanner on Cloudant
JavaScript
1
star
17

avfdemo

AVF Demo App
JavaScript
1
star
18

atljeremy.github.com

My personal home on GitHub/The Web
HTML
1
star
19

Floid

Kotlin Flow Based Reactive Architecture
Kotlin
1
star
20

jeremyfox

www.jeremyfox.me scala play 2 app
Scala
1
star
21

Bill-Planner

JavaScript
1
star
22

LoaderView

A loading view written in Swift to be used with iOS and OSX
Swift
1
star
23

first_app

First app for ruby on rails tutorial
Ruby
1
star
24

SDI-Project-4

CoffeeScript
1
star
25

pushservice

Scala
1
star
26

iospracticeapp

iOS Practice App / Tool Kit
Objective-C
1
star
27

JFAnalyticsClient

Objective-C analytics client that utilizes http://keen.io as the data store.
Objective-C
1
star
28

my_notes_hybrid

My Notes Android application with a web view for hybrid implementation
Java
1
star
29

VFW-Project-1

JavaScript
1
star
30

avfdemoandroid

AVF Demo App For Android
JavaScript
1
star
31

aoc1

Apple Programming Language Objective-C 1
Objective-C
1
star
32

SDI---Project-3

CoffeeScript
1
star
33

Extensions

A slew of Extensions that were built for use in iOS but should also be useful in OS X and tvOS too
Swift
1
star