Skip to content
forked from mgcm/MMPopLabel

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

License

Notifications You must be signed in to change notification settings

vvit/MMPopLabel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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];
}

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;

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, miltonmoura@gmail.com

License

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 77.5%
  • Ruby 22.5%