• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A radial menu for iOS, like the one introduced in Messages for iOS 8.

MTZRadialMenu

A radial menu control for iOS, like the one used in iOS 8 Messages.app


Example


This control is activated by long-pressing a button. A circle expands outwards from the button revealing different action items.

To create a radial menu, initalize one with a particular background visual effect (UIVisualEffect), configure the frame, delegate, and main button images, then add it to the view hierarchy.

self.cameraRadialMenu = [[MTZRadialMenu alloc] initWithBackgroundVisualEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
self.cameraRadialMenu.frame = left;
self.cameraRadialMenu.delegate = self;
[self.cameraRadialMenu setImage:[UIImage imageNamed:@"Camera"] forState:UIControlStateNormal];
[self.cameraRadialMenu setImage:[UIImage imageNamed:@"CameraHighlighted"] forState:UIControlStateSelected];
[self.view addSubview:self.cameraRadialMenu];

Menu items (MTZRadialMenuItem) are objects with information on the item's visual representation (some graphic) and the corresponding handler(s) associated with the different events. Create a menu item in one of three ways:

  • with a common standard item (MTZRadialMenuStandardItem)
  • with an icon (UIImage where renderingMode is treated as UIImageRenderingModeAlwaysTemplate)
  • with a pair of images to use for the normal and highlighted states.

A menu item is also responsible for handling the two different events:

  • highlight (the user dragged their finger over the item)
  • selection (the user lifted their finger while the item was highlighted)

For convenience, it is possible to configure a menu item with just a selection handler since many items (e.g. "Cancel") will only require such. Handling both states is common for actions like "Record" which activate when highlighting the action.

Handlers are blocks (MTZRadialMenuItemHighlightedHandler or MTZRadialMenuItemSelectedHandler) that are called when the item has been highlighted (or unhighlighted) or selected. Appropriate action is then taken from there.

Menu items are then added to the instance of the radial menu and assigned to certain locations (see setItem:forLocation:).

Usage Warnings

With MTZRadialMenu, you can create contextual radial menus presenting a few different actions. There are five locations for actions (center, top, right, bottom, and left). However, in most circumstances, only a couple of these locations should be used since the menu is likely on the edge of the display. The bottom location should rarely be used as this location is likely covered up by the user's finger when activating and using the menu. Be sure to use this in ways similar to Apple's uses to avoid confusion created by inconsistent use and behaviour of controls.

License

MIT blah blah blah. Use this and have fun. I'd love to hear about how you're using this in your application. Email me.

More Repositories

1

What-s-New

Easily present the latest changes and features to your users on app updates.
Objective-C
1,156
star
2

Colors

A collection of UIColor categories and helper APIs for picking colors and generating color schemes. Bring life and beauty into your iOS application through dynamic user interfaces.
Objective-C
205
star
3

Sketch-Xcode

Automatically Exporting Assets from Sketch into Xcode.
Objective-C
160
star
4

MTZTiltReflectionSlider

UISlider subclass mimicking and improving the tilt controlled slider added to Music.app in iOS 6
Objective-C
84
star
5

NetworkActivityIndicator

Easily work with the network activity indicator in the iOS status bar. UIApplication category and demo app.
Objective-C
54
star
6

Handedness

Determine handedness of a UIPinchGestureRecognizer
Objective-C
40
star
7

Keyboard

I have always had a lot of opinions on software keyboards, so I need to make my own custom keyboard.
Swift
36
star
8

Spring-Animation

A simple iOS app to demonstrate UIView spring animations.
Objective-C
32
star
9

iOS-Passcode

Passcode app for iOS
Objective-C
16
star
10

MTZTextField

Fixing an issue with `UITextField` where the highlighted state of the text field's clear button is always the default blue, and not the tint color of the text field.
Objective-C
15
star
11

Blog.txt

Plaintext to web-based blog.
PHP
14
star
12

MTZSplitViewController

Fixing API of `UISplitViewController`.
Objective-C
12
star
13

Sonar

A Native Mac App for Apple's Bug Reporter
Objective-C
9
star
14

Goodnight

An iOS app that tells you when to wake up or fall asleep based on 90 minute sleep cycles.
Objective-C
7
star
15

replace_icns

Replace application icons from the command line.
Python
4
star
16

PushBackControl

When interacting with a control, it "pushes back" and responds with realtime feedback.
Objective-C
4
star
17

SmartCrop

More intelligently crop photos.
Objective-C
3
star
18

Safari-Passcode

Create a nice Safari extension for the passcode generator tool
3
star
19

Honeycrisp

Honeycrisp is a collection of advanced user interface controls and tools built on top of the iOS SDK.
2
star
20

dotfiles

Shell
2
star
21

Rewritten-APIs

Rewriting the APIs of classes in UIKit (like UIActionSheet and UIAlertView) to make them more sensical and easier to use.
Objective-C
2
star
22

WWDC-2014-Scholarship-Application

My submission for the WWDC 2014 Scholarship. https://developer.apple.com/wwdc/students/
Objective-C
2
star
23

Cloud

A simple, easy-to-use, file management system.
PHP
1
star
24

Computer-or-Fridge

Computer or Fridge?
1
star
25

Instapaper

Read Later Contextual Menu
JavaScript
1
star
26

Proxy-Server

Proxy Server assignment for Network Programming.
C
1
star
27

SwipeToMoveCursor

Objective-C
1
star
28

Icon-Launchers

Mini dummy apps with replacement icons that launch the real app. This isn't practical for anything.
Objective-C
1
star
29

Slide-To-Reveal-Control

Control for Passcodes that reveals a hidden work in a field with a magnifying glass.
Objective-C
1
star