Latest 0.0.1
Homepage https://github.com/okmr-d/DOHamburgerButton
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

Carthage compatible
CocoaPods Version
Platform
License

Animated Hamburger Button written in Swift

Demo

Requirements

  • iOS 7.0+
  • Swift 1.2

Installation

Carthage

Add the following line to your Cartfile:

github "okmr-d/DOHamburgerButton"

CocoaPods

Add the following line to your Podfile:

pod 'DOHamburgerButton'

Manual

Just drag DOHamburgerButton.swift to your project.

How to use

By coding

1.create a button

let button = DOHamburgerButton(frame: CGRectMake(0, 0, 44, 44))
button.color = UIColor.whiteColor() // you can set button color
self.view.addSubview(button)

2.Add tapped function

button.addTarget(self, action: Selector("tapped:"), forControlEvents: .TouchUpInside)
func tapped(sender: DOHamburgerButton) {
    if sender.selected {
        sender.deselect()
    } else {
        sender.select()
    }
}

By using Storyboard or XIB

1.Add Button object and set Custom Class DOHamburgerButton
via Storyboard

(and you can set button color)
change Color

2.Add tapped function

@IBAction func tapped(sender: DOHamburgerButton) {
    if sender.selected {
        sender.deselect()
    } else {
        sender.select()
    }
}

3.Connect Outlet
connect outlet

DEMO

There is a demo project added to this repository, so you can see how it works.

License

This software is released under the MIT License.

Latest podspec

{
    "name": "DOHamburgerButton",
    "version": "0.0.1",
    "summary": "Animated Hamburger Button written in Swift",
    "homepage": "https://github.com/okmr-d/DOHamburgerButton",
    "screenshots": "https://raw.githubusercontent.com/okmr-d/okmr-d.github.io/master/img/DOHamburgerButton/demo.gif",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Daiki Okumura": "[email protected]"
    },
    "social_media_url": "http://twitter.com/okmr_d",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/okmr-d/DOHamburgerButton.git",
        "tag": "0.0.1"
    },
    "source_files": "DOHamburgerButton/*.swift",
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This