Popularity
0.3
Stable
Activity
0.0
Stable
1
2
0

Description

A simple, fun, menu UI element. Great replacement for hamburger menus and tab bar menus (UITabBar).

Code Quality Rank: L4
Programming language: Swift
License: MIT License
Tags: UI     Menu     Tab Bar    
Latest version: v1.0.10

JVFlowerMenu alternatives and similar libraries

Based on the "Menu" category.
Alternatively, view JVFlowerMenu alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of JVFlowerMenu or a related project?

Add another 'Menu' Library

README

JVFlowerMenu is a quick and easy replacement to a hamburger menu and possibly a UITabBar

The JVFlowerMenu is not a controller but rather a drop in UI element that you could then use to control the content of any UI View. Here is a quick example of the final product:

menuGIF

Setup

Cocoapods

pod 'JVFlowerMenu'

Limitations

1) Right now the classes are not @UIDesignable or @UIInspectable. This means that if you want to add them you have to add the constraints yourself in code or live and let live after you assign a frame.

2) Will have unexpected behavior if it's super view is not the root view of your view controller.

3) Any transforms you apply to the menu will mess up the behavior.

Example

initalize a JVFlowerMenu like this:

let menu = JVFlowerMenu(withImage: nil, andTitle: nil)

Initalizing with a nil image will default to a drawing of a hamburger menu. A nil title wil just produce nothing for the title.

Then you can add Pedals like this:

menu.addPedal(withImage: nil, withTitle: nil)
menu.addPedal(withImage: nil, withTitle: nil)
menu.addPedal(withImage: nil, withTitle: nil)

If you pass nil for a Pedal image it will default to a drawing of a circle. nil for the title will display nothing.

You can then become the delegate and get notified about events in these methods:

menu.delegate = self

//MARK: Delegate Functions

public func flowerMenuDidSelectPedalWithID(_ theMenu: JVFlowerMenu, pedal: Pedal) {
    print("\(pedal.ID) Selected")
}

public func flowerMenuDidExpand() {
    print("Flower Menu expanded")
}

public func flowerMenuDidRetract() {    
    print("Flower Menu Retracted")
}

There are some properties you can change to manipulate the behavior of the menu:

menu.startAngle = 90.0
menu.pedalDistance = 200
menu.pedalSpace = 20
menu.stagger = 0

Finally, here is some set up code for adding constraints progmatically:

override func viewDidLoad() {
    self.view.addSubview(menu)
    self.constrain()
}

func constrain() {
    var constraints = [NSLayoutConstraint]()
    let vertical = NSLayoutConstraint.constraints(withVisualFormat: "V:|-30-[pedal]", options: [], metrics: nil, views: ["pedal": self.menu])
    constraints.append(contentsOf: vertical)
    let horizontal = NSLayoutConstraint.constraints(withVisualFormat: "H:|-20-[pedal]", options: [], metrics: nil, views: ["pedal": self.menu])
    constraints.append(contentsOf: horizontal)
    self.view.addConstraints(constraints)
}