Latest 1.0.5
Homepage https://github.com/jonathantribouharet/JTHamburgerButton
License MIT
Platforms ios 7.0, requires ARC
Authors

CI Status
Version
License
Platform

An animated hamburger button for iOS.

Installation

With CocoaPods, add this line to your Podfile.

pod 'JTHamburgerButton', '~> 1.0'

Screenshots

Example

Usage

Basic usage

#import <UIKit/UIKit.h>

#import <JTHamburgerButton.h>

@interface ViewController : UIViewController

@property (weak, nonatomic) IBOutlet JTHamburgerButton *button;

@end
#import "ViewController.h"

@implementation ViewController

- (IBAction)didBackButtonTouch:(JTHamburgerButton *)sender
{
    if(sender.currentMode == JTHamburgerButtonModeHamburger){
        [sender setCurrentModeWithAnimation:JTHamburgerButtonModeArrow];
    }
    else{
        [sender setCurrentModeWithAnimation:JTHamburgerButtonModeHamburger];
    }
}

- (IBAction)didCloseButtonTouch:(JTHamburgerButton *)sender
{
    if(sender.currentMode == JTHamburgerButtonModeHamburger){
        [sender setCurrentModeWithAnimation:JTHamburgerButtonModeCross];
    }
    else{
        [sender setCurrentModeWithAnimation:JTHamburgerButtonModeHamburger];
    }
}

@end

The method setCurrentModeWithAnimation animates the transition from one mode to another. There is also setCurrentMode which changes the view without transition.

There are three modes:

  • JTHamburgerButtonModeHamburger
  • JTHamburgerButtonModeArrow
  • JTHamburgerButtonModeCross

Customize the design

  • lineHeight
  • lineWidth
  • lineSpacing
  • lineColor
  • animationDuration

After the change of one of this properties you have to call updateAppearance to update the view.

Requirements

  • iOS 7 or higher
  • Automatic Reference Counting (ARC)

Author

License

JTHamburgerButton is released under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "JTHamburgerButton",
    "version": "1.0.5",
    "summary": "An animated hamburger button for iOS",
    "homepage": "https://github.com/jonathantribouharet/JTHamburgerButton",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Jonathan Tribouharet": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/jonathantribouharet/JTHamburgerButton.git",
        "tag": "1.0.5"
    },
    "source_files": "JTHamburgerButton/*",
    "requires_arc": true,
    "screenshots": [
        "https://raw.githubusercontent.com/jonathantribouharet/JTHamburgerButton/master/Screens/example.gif"
    ]
}

Pin It on Pinterest

Share This