GithubHelp home page GithubHelp logo

jitalin / fdstatusbarnotifierview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frankdilo/fdstatusbarnotifierview

0.0 1.0 0.0 406 KB

A notifier view for iOS that resides in the status bar.

License: MIT License

Ruby 4.11% Objective-C 95.89%

fdstatusbarnotifierview's Introduction

No more in active development...

FDStatusBarNotifierView is a view that lets you display notifications and messages using the space in which the status bar resides.

Screenshot

Usage

It’s as easy to use as UIAlertView, here is an example:

// from a view controller
FDStatusBarNotifierView *notifierView = [[FDStatusBarNotifierView alloc] initWithMessage:@"Hello!"];
notifierView.timeOnScreen = 3.0; // by default it's 2 seconds
[notifierView showInWindow:self.view.window];

// or from a view controller with a navigation bar
[notifierView showAboveNavigationController:self.navigationController];

When you call showInWindow: the status bar disappear and the notifier view takes its place with a smooth animation.

Installation

The easiest way to install this component is via CocoaPods.

Add the following line to your podfile:

pod 'FDStatusBarNotifierView'

Then run the pod install command and import FDStatusBarNotifierView.h where you plan to use the notifier view.

You can also install this manually. Just drag FDStatusBarNotifierView.h and FDStatusBarNotifierView.m in your project and import the .h file where you want to use this component.

Advanced usage

Manually hide

In some circumstances (e.g. informing the user of network activities), you may want to manually hide the component.

To do so just set the manuallyHide property to YES. Then hide calling the hide method.

notifierView.manuallyHide = YES;

// do some stuff

[notifierView hide];

Hide on tap

If you set the shouldHideOnTap property to YES when the user taps the message it will be hidden.

Scrolling message

If the message you want to display doesn’t fit in the status bar it will be animated and scroll horizontally to display the full text.

Delegate methods

I've also created some handy self-explanatory delegate methods, if you need them.

- (void)willPresentNotifierView:(FDStatusBarNotifierView *)notifierView;  // before animation and showing view
- (void)didPresentNotifierView:(FDStatusBarNotifierView *)notifierView;   // after animation
- (void)willHideNotifierView:(FDStatusBarNotifierView *)notifierView;     // before hiding animation
- (void)didHideNotifierView:(FDStatusBarNotifierView *)notifierView;      // after animation
- (void)notifierViewTapped:(FDStatusBarNotifierView *)notifierView;       // user tap the status bar message

Contribute

Feel free to help out by sending pull requests or by creating new issues.

TO DO

  • Add support for multiple orientations (currently only portrait is supported).
  • Properly manage the animation queue, to avoid unexpected behavior when showInWindow: is called multiple times.

Contributors

  • ZachOrr: iPad support, hide on tap, better handling of device’s screen sizes.
  • dbsGen: if the message to display doesn’t fit in the status bar, it will scroll horizontally.
  • Luca Bernardi: CocoaPods support, manual hiding.
  • Stephen Williams: iOS 7 support and more

License

See the LICENSE file (MIT).

fdstatusbarnotifierview's People

Contributors

frankdilo avatar gpoitch avatar h0lyalg0rithm avatar luca-bernardi avatar mmccroskey avatar onato avatar zachorr avatar

Watchers

 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.