Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnvuko/jthamburgerbutton
An animated hamburger button for iOS.
https://github.com/johnvuko/jthamburgerbutton
hamburger hamburger-menu ios ios-animation
Last synced: 4 days ago
JSON representation
An animated hamburger button for iOS.
- Host: GitHub
- URL: https://github.com/johnvuko/jthamburgerbutton
- Owner: johnvuko
- License: mit
- Created: 2015-03-22T23:37:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-30T16:36:41.000Z (over 9 years ago)
- Last Synced: 2024-07-22T10:48:16.421Z (4 months ago)
- Topics: hamburger, hamburger-menu, ios, ios-animation
- Language: Objective-C
- Homepage:
- Size: 703 KB
- Stars: 350
- Watchers: 14
- Forks: 38
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JTHamburgerButton
[![CI Status](http://img.shields.io/travis/jonathantribouharet/JTHamburgerButton.svg)](https://travis-ci.org/jonathantribouharet/JTHamburgerButton)
![Version](https://img.shields.io/cocoapods/v/JTHamburgerButton.svg)
![License](https://img.shields.io/cocoapods/l/JTHamburgerButton.svg)
![Platform](https://img.shields.io/cocoapods/p/JTHamburgerButton.svg)An animated hamburger button for iOS.
## Installation
With [CocoaPods](http://cocoapods.org/), add this line to your Podfile.
pod 'JTHamburgerButton', '~> 1.0'
## Screenshots
![Example](./Screens/example.gif "Example View")
## Usage
### Basic usage
```objective-c
#import#import
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet JTHamburgerButton *button;
@end
``````objective-c
#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
- [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
## License
JTHamburgerButton is released under the MIT license. See the LICENSE file for more info.