All Projects → jonSurrey → JonContextMenu

jonSurrey / JonContextMenu

Licence: MIT license
A beautiful and minimalist arc menu like the Pinterest one, written in Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to JonContextMenu

vue3-context-menu
A very simple context menu component for Vue3 一个简洁美观简单的Vue3右键菜单组件
Stars: ✭ 74 (+23.33%)
Mutual labels:  menu, contextmenu, context-menu
ContextMenuSwift
A better version of iOS 13 Context Menu
Stars: ✭ 162 (+170%)
Mutual labels:  menu, contextmenu, context-menu
Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (+35%)
Mutual labels:  menu, contextmenu, context-menu
Context Menu.ios
You can easily add awesome animated context menu to your app.
Stars: ✭ 1,854 (+2990%)
Mutual labels:  menu, contextmenu, context-menu
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-76.67%)
Mutual labels:  menu, context-menu
elm-contextmenu
Flexible context menu for Elm
Stars: ✭ 16 (-73.33%)
Mutual labels:  contextmenu, context-menu
xMenuTools
Extended context menu tools for Windows
Stars: ✭ 56 (-6.67%)
Mutual labels:  menu, context-menu
ctxmenu
Tiny and customizable context menu generator
Stars: ✭ 20 (-66.67%)
Mutual labels:  contextmenu, context-menu
React Contexify
Add a context menu to your react app with ease
Stars: ✭ 575 (+858.33%)
Mutual labels:  menu, context-menu
Bubbleactions
An open source implementation of the long press actions in the Pinterest app.
Stars: ✭ 217 (+261.67%)
Mutual labels:  pinterest, menu
Jquery Ui Contextmenu
jQuery plugin that turns a jQueryUI menu widget into a context menu.
Stars: ✭ 170 (+183.33%)
Mutual labels:  menu, context-menu
rctx-contextmenu
✨ Context menu for React
Stars: ✭ 23 (-61.67%)
Mutual labels:  contextmenu, context-menu
Open in Windows Terminal
No description or website provided.
Stars: ✭ 24 (-60%)
Mutual labels:  contextmenu, context-menu
VirusTotalScanner
Scan suspicious applications with over 60 different anti-viruses with a mere two clicks and five seconds!
Stars: ✭ 18 (-70%)
Mutual labels:  contextmenu, context-menu
V Selectmenu
SelectMenu for Vuejs, A simple, easier and highly customized menu solution
Stars: ✭ 169 (+181.67%)
Mutual labels:  menu, contextmenu
Vue Menu
Menu/Contextmenu Component for vue2
Stars: ✭ 227 (+278.33%)
Mutual labels:  menu, contextmenu
ng2-right-click-menu
Right click context menu for Angular 2+
Stars: ✭ 51 (-15%)
Mutual labels:  contextmenu, context-menu
boardz
Create Pinterest-like boards with pure CSS, in less than 1kB.
Stars: ✭ 33 (-45%)
Mutual labels:  pinterest, pinterest-like
React Menu
React component for building accessible menu, dropdown, submenu, context menu and more.
Stars: ✭ 237 (+295%)
Mutual labels:  menu, contextmenu
ShellAnything
ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
Stars: ✭ 103 (+71.67%)
Mutual labels:  contextmenu, context-menu

JonContextMenu

CocoaPods Compatible License

A beautiful and minimalist arc menu like the Pinterest one, written in Swift. Allows you to add up to 8 items and customize it to the way you like!

Gif

How to use

// First import the library to your class file.
import JonContextMenu

// Create an array of type "JonItem" for the items you desire to show.
// "JonItem" constructor takes an id to identify the object, a String to be the title of the item and 
// an UIImage to be the icon of the item.
let items = [JonItem(id: 1, title: "Google"   , icon: UIImage(named:"google")),
             JonItem(id: 2, title: "Twitter"  , icon: UIImage(named:"twitter")),
             JonItem(id: 3, title: "Facebook" , icon: UIImage(named:"facebook")),
             JonItem(id: 4, title: "Instagram", icon: UIImage(named:"instagram"))]

The JonItem contructor has also a fourth optional parameter called "data". You can use it to add some object that you would like to have access later when selecting this item

JonItem(id: 1, title: "Google", icon: UIImage(named:"google", data: <<SOMEOBJECT>>)
// Then, create an instance of JonContextMenu setting your array to it.
let contextMenu = JonContextMenu().setItems(options).build()

// Finally, add the "contextMenu" to the view you wish.
<<YOURVIEW>>.addGestureRecognizer(contextMenu)

To show the menu, just long press the view you set the JonContextMenu.

Delegates

If you want to be notified when some interaction happens on the context menu, JonContextMenu has with 5 functions that you can implemement:

// Implement the JonContextMenuDelegate to your ViewController 
class ViewController:JonContextMenuDelegate{

    func menuOpened(){
      // Called when the JonContextMenu opens
    }
    func menuClosed(){
      // Called when the JonContextMenu closes
    }
    func menuItemWasSelected(item:JonItem){
      // Called when the user selects one of the items
    }
    func menuItemWasActivated(item:JonItem){
      // Called when the user interacts with one of the items
    }
    func menuItemWasDeactivated(item:JonItem){
      // Called when the user stops interacting with one of the items
    }
}

// Then, when creating an instance of JonContextMenu, set the delegate.
let contextMenu = JonContextMenu()
                  .setItems(options)
                  .setDelegate(self)
                  .build()

Custom Configuration

The default visual configuration for JonContextMenu will probably be enough for you, but if you wish to make a few custom modification, the library has some functions that allow you to personalize it as you wish.

JonContextMenu()

// The number of items to be displayed, it can be up to 8 items.
.setItems(options)

// The delegate to notify when an item is selected.
.setDelegate(self)

// The background colour of the view. The default colour is white and the default alpha is 0.9
.setBackgroundColorTo(.white, withAlpha: 0.5)

// The idle colour of the items(when there is no interaction). The default colour is white
.setItemsDefaultColorTo(.black)

// The idle colour of the items' icon(when there is no interaction).  There is no deafault colour. 
// If you don't set it, the icon will have no tint colour and will display the original image's colour
.setIconsDefaultColorTo(.white)

// The active colour of the items(when there is interaction). The default colour is darkRed
.setItemsActiveColorTo(.white)

// The active colour of the items' icon(when there is interaction). There is no deafault colour. 
// If you don't set it, the icon will have no tint colour and will display the original image's colour
.setIconsActiveColorTo(.black)

// The colour of the title of the items. The default colour is darkGray
.setItemsTitleColorTo(.black)

// The size of the title of the items. The default size is 72
.setItemsTitleSizeTo(50)

// The colour of touch point circle. The default colour is darkGray
.setTouchPointColorTo(.black)

Installation

CocoaPods

To integrate JonContextMenu to your project using CocoaPods, specify it in your Podfile:

target '<Your Target Name>' do
    pod 'JonContextMenu', :git => 'https://github.com/jonSurrey/JonContextMenu.git', :branch => 'master'
end

Then, run the following command:

$ pod install

Manual installation

First download the "JonContextMenu" folder. Then, in Xcode, right-click on the root of your project node in the project navigator. Click "Add Files" to “YOURPROJECTNAME”. In the file chooser, navigate to where "JonContextMenu" folder is and select JonContextMenu.xcodeproj. Click "Add" to add JonContextMenu.xcodeproj as a sub-project.

Select the top level of your project node to open the project editor. Click the YOUR_PROJECT_NAME target, and then go to the General tab.

Scroll down to the Embedded Binaries section. Drag JonContextMenu.framework from the Products folder of JonContextMenu.xcodeproj onto this section.

Clean and rebuild your project, and you should be good to go!

Collaboration

This is a simple libray that I created to help myself in my own work since I didnt find any other that would do what I wanted. I know that there is still here a lot of space for improvements and adding new features, so please, any ideas or issues, feel free to collaborate!

Author

Jonathan Martins, [email protected]

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].