Skip to content

Repository files navigation

#LIVBoingSegmentedControl

An animated segment menu using the pop animation library (https://github.com/facebook/pop). The menu is fully customizable in terms of number of segments, selected and unselected colors, selector image, selector velocity etc.

##Setup

You can either:

  1. Copy the the LIVBoingSegmentedControl directly into your Project
  2. Include the following cocoapod (preferred):
pod 'LIVBoingSegmentedControl'

##Usage

Import the required header file:

#import<LIVBoingSegmentedControl/LIVBoingSegmentedControl.h>//or without pod
#import"LIVBoingSegmentedControl.h"

Create the LIVBoingSegmentedControl with an array of labels, a frame and set certain properties:

//Segement labelsNSArray *menuItems = @[@"Map",@"Favourites",@"Starred"];
// Container Frame
CGRect screenRect = [[UIScreen mainScreen] bounds];
float x = 0;
float y = 0;
float width = screenRect.size.width;
float height = 55;
CGRect menuFrame = CGRectMake(x, y, width, height);
// Init
_menu = [[LIVBoingSegmentedControl alloc] initMenuWithFrame:menuFrame menuItems:menuItems];
// Change properties
_menu.delegate = self;
_menu.boinginess = 15;
_menu.selectedLabelColor = [UIColor whiteColor];
// Add to view
[_menu addMenuToView:self.view];

###Initialisation

How to create the bubble menu:

At a certain point in a view:

[[LIVBoingSegmentedControl alloc] initMenuWithFrame:menuFrame menuItems:menuItems];

###Delegates

The following delegate is available:

//User selected a segment
-(void)livBoingSegmentedControl:(LIVBoingSegmentedControl *)boingMenu tappedSegmentWithIndex:(NSUInteger)index {
NSLog(@"Tapped: %lu", (unsignedlong)index);
}

##Customizable Properties

PropertyTypeDescriptionDefault Value
menuItemsNSArray*Title for each menu item.-
menuFrameCGRectThe frame for the menu.-
barBackgroundColorSelectedUIColorBackground of segment when it is selected.Green
barBackgroundColorUnSelectedUIColorBackground of segment when it is not selected.Green
selectedLabelFontUIFontFont of segment label when it is selected.HelveticaNeue
unSelectedLabelFontUIFontFont of segment label when it is not selected.HelveticaNeue
selectedLabelColorUIColorFont color of segment label when it is selected.White
unSelectedLabelColorUIColorFont color of segment label when it is not selected.Grey
labelYPositionfloatY position of label in bar.6
selectorImageUIImageImage for the selector which shows which tab is selected.-
selectorTintColorUIColorColor of the image of the selector.Green
selectorViewWidthfloatSelector image width.20
selectorViewHeightfloatSelector image height.10
boingActivatedBooleanTrue if the selector must boing.TRUE
boinginessfloatHow much boing the selector must have.15
boingVelocityidHow much velocity the selector must have.@(1000)
boingMassfloatHow much mass the selector must have.0.6

##Requirements

ARC, iOS 8.0+, Xcode 6+

##Upcoming Features

  • Images as bar background.
  • Landscape support.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

12 watching

Forks

Releases

Packages

Contributors

Languages