Code Monkey home page Code Monkey logo

pathmenu's Introduction

Notice: PathMenu is no longer being maintained/updated.

PathMenu

Platform Swift3.0 Build Status License

Path 4.2 menu using CoreAnimation in Swift. Inspired by AwesomeMenu.

Screenshot

PathMenu-Sample PathMenu

Installation

Cocoapods

The easiest way to get started is to use CocoaPods. Add the following line to your Podfile:

platform :ios, '8.0'
use_frameworks!
# The following is a Library of Swift.
pod 'PathMenu'

Then, run the following command:

pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate PathMenu into your Xcode project using Carthage, specify it in your Cartfile:

github "pixyzehn/PathMenu"

Run carthage update.

$ carthage update

Other

Add the PathMenu (including PathMenu.swift and PathMenuItem.swift) folder into your project.


How to use it?

Create the PathMenu by setting up the PathMenuItem.

For the details, please refer to PathMenu-Sample.

let menuItemImage = UIImage(named: "bg-menuitem")!
let menuItemHighlitedImage = UIImage(named: "bg-menuitem-highlighted")!

let starImage = UIImage(named: "icon-star")!

let starMenuItem1 = PathMenuItem(image: menuItemImage, highlightedImage: menuItemHighlitedImage, contentImage: starImage)

let starMenuItem2 = PathMenuItem(image: menuItemImage, highlightedImage: menuItemHighlitedImage, contentImage: starImage)

let starMenuItem3 = PathMenuItem(image: menuItemImage, highlightedImage: menuItemHighlitedImage, contentImage: starImage)

let starMenuItem4 = PathMenuItem(image: menuItemImage, highlightedImage: menuItemHighlitedImage, contentImage: starImage)

let starMenuItem5 = PathMenuItem(image: menuItemImage, highlightedImage: menuItemHighlitedImage, contentImage: starImage)

let items = [starMenuItem1, starMenuItem2, starMenuItem3, starMenuItem4, starMenuItem5]

let startItem = PathMenuItem(image: UIImage(named: "bg-addbutton")!,
                  highlightedImage: UIImage(named: "bg-addbutton-highlighted"),
                      contentImage: UIImage(named: "icon-plus"),
           highlightedContentImage: UIImage(named: "icon-plus-highlighted"))

let menu = PathMenu(frame: view.bounds, startItem: startItem, items: items)
menu.delegate = self

And then, setup the PathMenu and some options.

The following is the options about animation and position.

PathMenu-Sample project is similar to real Path’s menu.

Quote from the PathMenu-Sample project.

menu.startPoint = CGPointMake(UIScreen.mainScreen().bounds.width/2, self.view.frame.size.height - 30.0)
menu.menuWholeAngle = CGFloat(M_PI) - CGFloat(M_PI/5)
menu.rotateAngle = -CGFloat(M_PI_2) + CGFloat(M_PI/5) * 1/2
menu.timeOffset = 0.0
menu.farRadius = 110.0
menu.nearRadius = 90.0
menu.endRadius = 100.0
menu.animationDuration = 0.5

The order is farRadius→nearRadius→endRadius.

Default values are as follows:

startPoint = CGPointMake(UIScreen.mainScreen().bounds.width/2, UIScreen.mainScreen().bounds.height/2)
timeOffset                    = 0.036
rotateAngle                   = 0.0
menuWholeAngle                = CGFloat(M_PI * 2)
expandRotation                = -CGFloat(M_PI * 2)
closeRotation                 = CGFloat(M_PI * 2)
animationDuration             = 0.5
expandRotateAnimationDuration = 2.0
closeRotateAnimationDuration  = 1.0
startMenuAnimationDuration    = 0.2
nearRadius                    = 110.0
endRadius                     = 120.0
farRadius                     = 140.0

Delegate protocol (PathMenuDelegate)

func didSelect(on menu: PathMenu, index: Int)
func didFinishAnimationClose(on menu: PathMenu)
func didFinishAnimationOpen(on menu: PathMenu)
func willStartAnimationOpen(on menu: PathMenu)
func willStartAnimationClose(on menu: PathMenu)

Licence

MIT

Author

pixyzehn

pathmenu's People

Contributors

jeffreyjackson avatar pixyzehn avatar takkyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pathmenu's Issues

Scrolling behavior

Thank you very much for doing this.

I'm using this on top of a tableview that scrolls. The menu button also scrolls with the tableview. Is there a way that the button could be fixed and static in the bottom?

Thank you in advance.

IOS 10 with swift 3.0

Now that swift 3.0 is released for devs, pathMenu can't compile.
Have you tried to convert your code to latest swift syntax ?
Thank you
capture d ecran 2016-09-09 a 00 25 51

Response to Touches Delayed

I have the path menu implemented as a subview to a tableview cell. For some reason, opening the menu only occurs by pressing and holding the start menu item down for a half second or so. And menu items aren't being selected until they are held down for at least a second or more. There seems to be an issue with touches when implemented as a subview to a cell.

Unable to Click PathMenuItem

Hello, great plugin! I'm unable to click any item button....Here's my setup. I've assigned the PathMenu to a view of size 40x40. Then I put my own custom button ontop of it, and invoke "handleTap" on behalf of the menu. The PathMenuItem images expand however, I'm unable to click any item. I do not have "Clip subviews" checked, Any thoughts as to why this would be?

Some PathMenuItem buttons land ontop of other button objects, and when I press the PathMenuItem button (that resides ontop of other buttons) the behind button does not get pressed so the object is clearly sitting ontop, just doesn't recognize any interaction.

PS: Could you possibly introduce a way to hide the PathMenuItems when collapsed?

screen shot 2015-10-08 at 9 32 21 am
screen shot 2015-10-08 at 9 32 34 am

On tap start item is moving up a few pixels

Strange one this. Brought everything into my project and all is working well, with one exception. On tap the + menu button rotates as expected but moves up a few pixels. Any idea why?

How can I add text below the icons

Hello,

I need to add text to the PathMenu icons just under the icons.
img_3618

I have attached a screen shots.

The text, "Status", "Water", "Food", "Exercise", and "Weight" are all text added to the menu items and move with the menu item.

Can you help guiding me how to do that or it is not supported?

Cheers,
adam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.