RadialMenu is a custom control for providing a touch context menu (like iMessage recording in iOS 8) built with Swift & POP

Overview

RadialMenu

Looking for help? For $150/hr I'll help with your RadialMenu problems including integrating it into your project. Email [email protected] to get started!

Experimental Software: Fun to play with, but probably shouldn't put it in production (yet).

RadialMenu is a custom control that allows you to provide a context menu to a user on a touch screen (generally after a long press). This is similar to the record functionality Apple introduced for iMessage in iOS 8.

Here's an example of the iMessage menu recreated, taken from the demo app:

iMessage RadialMenu Custom Control Example

You can create your own custom menus as well

Custom RadialMenu Control Example

Plus it's built with Facebook POP, so it's very flexible!

Read the blog entry at http://bradjasper.com/blog/radialmenu-imessage-ios8/ for more information.

Install

Copy the source files from the RadialMenu/ directory into your project.

How to use?

There are two examples provided which show how to use the control in detail (download and run the Xcode project). At a highlevel:

// Create a radial submenu (it's just a UIView subclass)
let subMenuRed = RadialSubMenu(frame: frameOfSubMenu)
subMenuRed.userInteractionEnabled = true
subMenuRed.layer.cornerRadius = subMenuRadius
subMenuRed.layer.backgroundColor = UIColor.redColor()
subMenuRed.layer.borderColor = UIColor.blackColor()
subMenuRed.layer.borderWidth = 1
subMenuRed.tag = tag


// Create multiple submenus and assign to array
let subMenus = [subMenuRed, subMenuBlue, ...]


// Initialize the radial menu
let radialMenu = RadialMenu(menus: subMenus, radius: menuRadius)
radialMenu.center = view.center
radialMenu.openDelayStep = 0.05
radialMenu.closeDelayStep = 0.00
radialMenu.minAngle = 180
radialMenu.maxAngle = 360
radialMenu.activatedDelay = 1.0
radialMenu.backgroundView.alpha = 0.0

// Setup event handlers for specific actions
radialMenu.onOpen = {
    // menu has opened
}

radialMenu.onHighlight = { subMenu in
    // perform highlight change
}

radialMenu.onActivate = { subMenu in
    // did select subMenu
}


// Setup menu to show when pressing a button
let longPress = UILongPressGestureRecognizer(target: self, action: "pressedButton:")
button.addGestureRecognizer(longPress)

// Gesture handler can react to menu in different ways depending what you want
// (for example, keeping the menu open if nothing is selected)
func pressedButton(gesture:UIGestureRecognizer) {
    switch(gesture.state) {
        case .Began:
            radialMenu.openAtPosition(button.center)
        case .Ended:
            radialMenu.close()
        case .Changed:
            radialMenu.moveAtPosition(gesture.locationInView(self.view))
        default:
            break
    }
}

Todo

  • Documentation
  • Convert to NSControl sublcass
  • Figure out CocoaPods/framework distribution for Swift
  • Fix other FIXME's & TODO's in source code

LICENSE

MIT

Read More

Contact

Web: http://bradjasper.com
Twitter: @bradjasper
Email: [email protected]

You might also like...
Slide-Menu - A Simple Slide Menu With Swift
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

Control your display's brightness from the macOS menu bar. Simple and easy to use.
Control your display's brightness from the macOS menu bar. Simple and easy to use.

MonitorControl Lite Control your display's brightness from the macOS menu bar. Simple and easy to use. About MonitorControl Lite is a simplified versi

EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

Hamburger Menu Button -  A hamburger menu button with full customization
Hamburger Menu Button - A hamburger menu button with full customization

Hamburger Menu Button A hamburger menu button with full customization. Inspired by VinhLe's idea on the Dribble How to use it You can config the looks

Completion Block for UINavigationController Push/Pop UIViewController

JNAPushPopCompletionBlock Synopsis Completion block for [self.navigationController pushViewController:(nonnull UIViewController *) animated:(BOOL)] an

Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Ambar is a macOS Menu Bar app built with SwiftUI.
Ambar is a macOS Menu Bar app built with SwiftUI.

Ambar Ambar is a macOS Menu Bar app built with SwiftUI. It is a template project which means that it can be used as a starting point for a new Menu Ba

A custom SwiftUI modifier to present an ActionSheet or a Popover menu
A custom SwiftUI modifier to present an ActionSheet or a Popover menu

ActionOver A custom SwiftUI modifier to present an Action Sheet on iPhone and a Popover on iPad and Mac. iPhone Preview iPad Preview Mac Preview Featu

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app.  It is written in pure swift.
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Comments
  • Update for Swift 1.2.

    Update for Swift 1.2.

    There were a bunch of errors, so I figured I'd fix them, if that is OK with you. However, no matter what I did, I couldn't get the tests to compile, so I removed them. It seems to work with the latest Xcode.

    opened by eccfcco15 1
  • Error

    Error

    I am getting below error while trying to run it PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/AbhiVashistha/Library/Developer/Xcode/DerivedData/RadialMenu-ffzdvhptwyuwajdipcsfouhovbkn/Build/Intermediates/RadialMenu.build/Debug-iphonesimulator/RadialMenu.build/Script-7FC4E313ABC6435B9FFC2A1F.sh cd /Users/AbhiVashistha/Downloads/RadialMenu-master /bin/sh -c /Users/AbhiVashistha/Library/Developer/Xcode/DerivedData/RadialMenu-ffzdvhptwyuwajdipcsfouhovbkn/Build/Intermediates/RadialMenu.build/Debug-iphonesimulator/RadialMenu.build/Script-7FC4E313ABC6435B9FFC2A1F.sh

    diff: /../Podfile.lock: No such file or directory diff: /Manifest.lock: No such file or directory error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

    Uploading Screen Shot 2015-05-15 at 5.40.42 pm.png…

    opened by AbhiVashistha 0
  • Tuple conversion error.

    Tuple conversion error.

    Cannot express tuple conversion '(index: Int, element: (distance: Double, subMenu: RadialSubMenu))' to '(Int, (Double, RadialSubMenu))'

    I am getting above error while trying to implement your example. Can you please help me screen shot 2015-05-15 at 8 12 51 pm

    opened by AbhiVashistha 1
Owner
Brad Jasper
Product Developer bootstrapping products like Focus, RemoteHabits and Catch Notes
Brad Jasper
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
Context menu similar to the one in the Pinterest iOS app

VLDContextSheet A clone of the Pinterest iOS app context menu. Example Usage VLDContextSheetItem *item1 = [[VLDContextSheetItem alloc] initWithTitle:

Vladimir Angelov 173 Mar 28, 2022
An iOS context menu UI inspired by Things 3.

Contextual menus with delightful animations and styles Total control over menu contents using your own UIViewControllers Tons of feature and interacti

GitHawk 971 Nov 30, 2022
You can easily add awesome animated context menu to your app.

Context-Menu.iOS You can easily add awesome animated context menu to your app. Made in Check this [project on dribbble] (https://dribbble.com/shots/17

Yalantis 1.8k Nov 17, 2022
An easy way to use `canPerformAction` for context menu in SwiftUI.

Use canPerformAction for TextField/Editor in SwiftUI You know how a TextField displays a set of context menu? It doesn't matter if it's UIKit or Swift

StuFF mc 5 Dec 18, 2021
PopMenu is pop animation menu inspired by Sina weibo / NetEase app.

PopMenu PopMenu is pop animation menu inspired by Sina weibo / NetEase app. Screenshots Installation CocoaPods With CocoaPods, add this line to your P

曾宪华 898 Nov 14, 2022
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

Unfortunately, life gets in the way sometimes and I won't be able to maintain this library any longer and upgrade this library to where it needs to be

null 5.2k Dec 31, 2022
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

▤ SideMenu If you like SideMenu, give it a ★ at the top right of this page. SideMenu needs your help! If you're a skilled iOS developer and want to he

Jon Kent 5.4k Dec 29, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020