GithubHelp home page GithubHelp logo

nsakhan / mmpoplabel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgcm/mmpoplabel

0.0 2.0 0.0 930 KB

A popping label with optional buttons, useful for tutorial-like tips

License: MIT License

Objective-C 79.06% Ruby 20.94%

mmpoplabel's Introduction

MMPopLabel

Version License Platform

Usage

To run the example project; clone the repo, and run pod install from the Example directory first.

To use it in your view controller, with styles and buttons:

// set appearance style
[[MMPopLabel appearance] setLabelColor:[UIColor blueColor]];
[[MMPopLabel appearance] setLabelTextColor:[UIColor whiteColor]];
[[MMPopLabel appearance] setLabelTextHighlightColor:[UIColor greenColor]];
[[MMPopLabel appearance] setLabelFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f]];
[[MMPopLabel appearance] setButtonFont:[UIFont fontWithName:@"HelveticaNeue" size:12.0f]];

// _label is a view controller property
_label = [MMPopLabel popLabelWithText:
          @"Lorem Ipsum is simply dummy text of the printing and typesetting industry. "
          "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s."];

// add a couple of buttons
UIButton *skipButton = [[UIButton alloc] initWithFrame:CGRectZero];
[skipButton setTitle:NSLocalizedString(@"Skip Tutorial", @"Skip Tutorial Button") forState:UIControlStateNormal];
[_label addButton:skipButton];

UIButton *okButton = [[UIButton alloc] initWithFrame:CGRectZero];
[okButton setTitle:NSLocalizedString(@"OK, Got It!", @"Dismiss Button") forState:UIControlStateNormal];
[_label addButton:okButton];

// add it to your view
[self.view addSubview:_label];

To show the label, just add this code to a button action or some other type of event, passing in the view you wish to point to:

- (IBAction)showLabel:(id)sender
{
	UIView *view = (UIView *)sender;
	[_label popAtView:view];
}

MMPopLabel now also supports UIBarButtonItem:

- (IBAction)showLabel:(id)sender
{
	UIBarButtonItem *barButtonItem = (UIBarButtonItem *)sender;
	[_label popAtBarButtonItem:barButtonItem];
}

To receive the label events, just set your view controller as it's delegate and implement the MMPopLabelDelegate protocol:

- (void)dismissedPopLabel:(MMPopLabel *)popLabel;
- (void)didPressButtonForPopLabel:(MMPopLabel *)popLabel atIndex:(NSInteger)index;

To disable animations, use of the following option when setting up your label:

_label = [MMPopLabel popLabelWithText:
          @"Lorem Ipsum is simply dummy text of the printing and typesetting industry. "
          "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s." options:MMPopLabelAnimationOptionDontPop];

Check the MMPopLabelAnimationOptions enumeration for more options.

Screenshots

Screen #1 Screen #2 Screen #3

Requirements

  • iOS 7.0+ and XCode 5.1+

Installation

MMPopLabel is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MMPopLabel"

Author

mgcm, [email protected]

License

MMPopLabel is available under the MIT license. See the LICENSE file for more info.

mmpoplabel's People

Contributors

mgcm avatar marcelofabri avatar

Watchers

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