Latest 0.1.1
Homepage https://github.com/catchzeng/InteractiveCircularMenu
License MIT
Platforms ios 9.0
Authors

Version
License
Platform

Interactive, springback, customizable(color, width, speed, angles) circular menu.

Example

InteractiveCircularMenu

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

InteractiveCircularMenu is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'InteractiveCircularMenu'

Concept

StartAngleOffset

InteractiveCircularMenu

SpeedRatio

Interactive speed, default is 1.0 .

CircularWidth

InteractiveCircularMenu

SpacingAngle

InteractiveCircularMenu

MaxAngle

The max angle you can scroll.

MinAngle

The min angle you can scroll.

MaxSpringbackAngle

The max angle for springback, default is maxAngle-spacingAngle.

MinSpringbackAngle

The min angle for springback, default is minAngle+spacingAngle.

Usage

Init InteractiveCircularMenu and set dataSource & delegate

menuView.dataSource = self
menuView.delegate = self

Set menu color your like.

menuView.menuColor = UIColor.white

Reload when dataSource changed.

menuView.reload()

Implement dataSource & delegate

extension ViewController: InteractiveCircularMenuDataSource {
    func numberOfItems(in menu: InteractiveCircularMenu) -> Int {
        return items.count
    }

    func menu(_ menu: InteractiveCircularMenu, itemAt index: Int) -> CircularMenuItem {
        return items[index]
    }
}

extension ViewController: InteractiveCircularMenuDelegate {
    func menu(_ menu: InteractiveCircularMenu, didSelectAt index: Int) {
        AlertControllerBuilder(title: "Tip",
                               message: "Click:(index+1)").addAction(title: "OK") { (_) in
        }.build().show()
    }

    func circularWidth(in menu: InteractiveCircularMenu) -> CGFloat {
        return 80
    }

    func menu(_ menu: InteractiveCircularMenu, itemSizeAt index: Int) -> CGSize {
        let width = circularWidth(in: menu)
        return CGSize(width: width*0.9, height: width*0.9)
    }

    func startAngleOffset(_ menu: InteractiveCircularMenu) -> CGFloat {
        return 60
    }

    func spacingAngle(_ menu: InteractiveCircularMenu) -> CGFloat {
        return 30
    }

    func maxAngle(_ menu: InteractiveCircularMenu) -> CGFloat {
        return startAngleOffset(menu) + 2*spacingAngle(menu)
    }

    func minAngle(_ menu: InteractiveCircularMenu) -> CGFloat {
        let offset = startAngleOffset(menu)
        let spacing = spacingAngle(menu)
        return offset-spacing*CGFloat(items.count-1)
    }
}

Author

catchzeng, [email protected]

License

InteractiveCircularMenu is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "InteractiveCircularMenu",
    "version": "0.1.1",
    "swift_version": "4.2",
    "summary": "Interactive circular menu",
    "description": "Interactive, infinite, springback, customizable(color, width, speed, angles) circular menu.",
    "homepage": "https://github.com/catchzeng/InteractiveCircularMenu",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "catchzeng": "[email protected]"
    },
    "source": {
        "git": "https://github.com/catchzeng/InteractiveCircularMenu.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "InteractiveCircularMenu/Classes/**/*"
}

Pin It on Pinterest

Share This