Code Monkey home page Code Monkey logo

navigationnotice's Introduction

NavigationNotice

Carthage compatible Version License Platform

Customizable and interactive animated notification UI control.
Easy to write at chainable syntax.

Notice

Requirements

  • Swift 5.0
  • iOS 7.0 or later

How to Install NavigationNotice

iOS 8+

CocoaPods

Add the following to your Podfile:

pod "NavigationNotice"
use_frameworks!

Carthage

Add the following to your Cartfile:

github "KyoheiG3/NavigationNotice"

iOS 7

Just add everything in the NavigationNotice.swift file to your project.

Usage

import

If target is ios8.0 or later, please import the NavigationNotice.

import NavigationNotice

Example

Show simply notification.

let noticeView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 64))
NavigationNotice.addContent(noticeView).showOn(self.view).hide(2)
  • Automatically set width.
  • height of notification is same as height of the content.
  • Hide at 2 sec from displayed in this example.

Set status bar hidden and animated block.

let noticeView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 64))
NavigationNotice.addContent(noticeView).showOn(self.view).showAnimations { animations, completion in
    UIView.animateWithDuration(0.6, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.1, options: .BeginFromCurrentState, animations: animations, completion: completion)
} .hideAnimations { animations, completion in
    UIView.animateWithDuration(0.8, animations: animations, completion: completion)
}
  • Not hidden status bar.
  • Custome show and hide animation.

Variable

class var defaultShowAnimations: ((() -> Void, (Bool) -> Void) -> Void)?
  • Common animated block of show.
  • Default is nil.
class var defaultHideAnimations: ((() -> Void, (Bool) -> Void) -> Void)?
  • Common animated block of hide.
  • Default is nil.

Function

class func currentNotice() -> NavigationNotice.NavigationNotice?
  • Return NavigationNotice optional instance that is currently displayed.
class func addContent(view: UIView) -> NavigationNotice.NavigationNotice
  • Add content to display.
  • Return NavigationNotice instance.
class func onStatusBar(on: Bool) -> NavigationNotice
  • Set on the status bar of notification.
  • Return NavigationNotice instance.
func completion(completion: (() -> Void)?)
  • Completion handler.
func addContent(view: UIView) -> Self
  • Add content to display.
  • Return Self instance.
func showOn(view: UIView) -> Self
  • Show notification on view.
  • Return Self instance.
func showAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self
  • Animated block of show.
  • Return Self instance.
func hideAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self
  • Animated block of hide.
  • Return Self instance.
func hide(interval: NSTimeInterval) -> Self
  • Hide notification.
  • Return Self instance.
func removeAll(hidden: Bool) -> Self
  • Remove all notification.
  • Return Self instance.

LICENSE

Under the MIT license. See LICENSE file for details.

navigationnotice's People

Contributors

ichikawa7ss avatar kyoheig3 avatar readmecritic avatar tasanobu avatar y-okudera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

navigationnotice's Issues

Notice View Width CR

Hey, thanks for this super useful control :)
Could you maybe add a functionality to restrict the width of the notice view to the _ showOn_ view? Currently the view always seems to size to the rootViewController view width, which is not always the preferred behavior.

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.