Git Product home page Git Product logo

dxtopbarmessageview's Introduction

DXTopBarMessageView

Sometimes we think the alert view is a little annoying when we alert again and again if there are some problems like the awful network.

Sometimes it will be more delightful if you show the message on the top of your viewController and then it dimiss automatically after a while.

If you have used instagram, maybe you will have a figure on that.

This maybe is your solution

A category base on UIViewController, easy to use and custom.

How to use

  1. Import "UIViewController+TopBarMessage.h" to your own viewController or the .pch file

  2. In your viewController implementation, just use [self showTopMessage:@"Oops, some message appears"]

  3. A more detail api is, which can custom the top bar display, and recieve the tap gesture response on the topBar.

     	/**
     	 *  show the message with config the top bar
     	 *
     	 *  @param message    the text to show
     	 *  @param config     the top bar view config, the whole version will be @{kDXTopBarBackgroundColor:[UIColor blueColor], kDXTopBarTextColor : [UIColor yellowColor], kDXTopBarIcon : [UIImage imageNamed:@"icon.png"], kDXTopBarTextFont : [UIFont boldSystemFontOfSize:15.0]}
     	 *  @param delay      time to dismiss
     	 *  @param tapHandler the tap handler
     	 */
     	- (void)showTopMessage:(NSString *)message topBarConfig:(NSDictionary *)config dismissDelay:(float)delay withTapBlock:(dispatch_block_t)tapHandler;
    

Maybe beyond your consideration

  1. Support the device rotation, just use it.
  2. Gesture swipe to up will dismiss the topbar animated.
  3. In iOS7 it needs to change your viewController's property edgesForExtendedLayout to UIRectEdgeNone in the viewDidLoad, otherwise, the top will display on the top of the viewController not under the navigationbar.

Finally

Demo sceenShot

anyStr1

dxtopbarmessageview's People

Contributors

xiekw2010 avatar

Watchers

James Cloos avatar thneng 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.