A simple circle style menu.

Overview

Support CocoaPods.

New at 2019.02.25

  1. Use @property (nonatomic, assign) BOOL isOpened; can open or close RoundMenu.

  2. use -(void)setButtonEnable:(BOOL)enable atIndex:(NSUInteger)index; can config button with RoundMenu.

New at 2017.5.11

Add offset after the menu is opened.

self.roundMenu2.offsetAfterOpened = CGSizeMake(-80, -80);

preview

New at 6.16

  1. Add function to set custom image as center button icon.
  2. Add swift demo.

CocoaPods

pod 'XXXRoundMenuButton'

XXXRoundMenuButton

一个简单的圆形菜单控件。设计来自InVision团队的 Filter Menu by Anton Aheichanka for InVisionSecret Project by Anton Aheichanka Follow for InVision Follow

A simple circle style menu. Design from Filter Menu by Anton Aheichanka for InVision and Secret Project by Anton Aheichanka Follow for InVision Follow

preview

Angle

/**
*  config function
*
*  @param icons        array of UIImages
*  @param degree       start degree
*  @param layoutDegree angle span
*/
- (void)loadButtonWithIcons:(NSArray<UIImage*>*)icons startDegree:(CGFloat)degree layoutDegree:(CGFloat)layoutDegree;

startDegree 0 degree is ⬇️ , layoutDegree is the span between start and end, counterclockwise.

Update

2016.4.19 Fix the issue that touch event can't send to UIView covered by XXXRoundMenuButton

Easy use interface

self.roundMenu.centerButtonSize = CGSizeMake(44, 44);
self.roundMenu.centerIconType = XXXIconTypeUserDraw;
self.roundMenu.tintColor = [UIColor whiteColor];
self.roundMenu.jumpOutButtonOnebyOne = YES;

[self.roundMenu setDrawCenterButtonIconBlock:^(CGRect rect, UIControlState state) {

if (state == UIControlStateNormal)
{
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 - 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectanglePath fill];


UIBezierPath* rectangle2Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle2Path fill];

UIBezierPath* rectangle3Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 + 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle3Path fill];
}
}];

[self.roundMenu loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]

] startDegree:0 layoutDegree:M_PI*2*7/8];

[self.roundMenu setButtonClickBlock:^(NSInteger idx) {

NSLog(@"button %@ clicked !",@(idx));
}];


/**
*  RoundMenu2 config
*/
[self.roundMenu2 loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]

] startDegree:-M_PI layoutDegree:M_PI/2];
[self.roundMenu2 setButtonClickBlock:^(NSInteger idx) {

NSLog(@"button %@ clicked !",@(idx));
}];

self.roundMenu2.tintColor = [UIColor whiteColor];

self.roundMenu2.mainColor = [UIColor colorWithRed:0.13 green:0.58 blue:0.95 alpha:1];
Comments
  • layoutDegree

    layoutDegree

    I understand that startDegree is where the first button object begins. I don't quite understand layout Degree.

    In your first example, it represents the angle that is the gap between the button objects.??

    In the second example, there are 3 button objects and the layout degree is 90degrees?

    opened by pjebs 4
  • ButtonClick in Swift

    ButtonClick in Swift

    Trying to call:

    roundedButtonNavigation.buttonClickBlock { idx in
    }
    

    from a swift class, but the compiler rejects it with:

    Cannot call value of non-function type '((Int) -> Void)!'

    Any idea on how to call this block properly from Swift?

    opened by DonBaronFactory 3
  • Data Type Inconsistency for Degree

    Data Type Inconsistency for Degree

    Please take a look at the method which pass in the parameter for the start degree and layout degree

    XXXRoundMenuButton.h - (void)animatedLoadIcons:(NSArray<UIImage*>*)icons start:(CGFloat)start layoutDegree:(CGFloat)layoutDegree oneByOne:(BOOL)onebyone;

    XXXRoundMenuButton.m

    - (void)animatedLoadIcons:(NSArray<UIImage*>*)icons start:(CGFloat)start layoutDegree:(CGFloat)layoutDegree oneByOne:(BOOL)onebyone;
    - (void)animatedLoadIcons:(NSArray<UIImage*>*)icons start:(double)start layoutDegree:(double)layoutDegree oneByOne:(BOOL)onebyone
    

    There's inconsistency on the data type for the layoutDegree and startDegree which causes conflicting parameters types. It's causing issue when I try to run on iphone4/5 , the icon didn't fan out circling the center of it, but instead it stick at one location, or at the wrong location. When I try to nslog the layoutDegree parameter, it shows 0.000000 instead of a proper value. But once I change the "double" to "CGFloat" , then it manage to pass in proper value for the layoutDegree and perform the animation properly.

    opened by fatsolow88 2
  • close outer arch

    close outer arch

    I want to close the outer arch of a button. when I click on a button it gets open and loads sub buttons but if I haven't close it manually it remains open. How can I close it without clicking again on a button?

    opened by KaustubhAproTech 1
  • disable a subbutton

    disable a subbutton

    I've this button with 4 sub-button. I would like that one of this 4 sub button is disabled and get enabled if it is in some situation. e.g the share button,I would like be disabled at start, but when appear a detail to share this button become enabled.

    is it possible? How?

    opened by Rufy86 1
  • Share button on all app with Secret Project effect

    Share button on all app with Secret Project effect

    Hi, I've a tab bar-based app and I would like to show the button on all app. How can I do it? Furthermore, I would like to add the button behind the tab bar, so when the button expands after the click, the effect is like shown in Secret Project:https://dribbble.com/shots/1928064-Secret-Project. How can I do it?

    Thank you

    opened by Rufy86 1
  • Swift: Expected ',' separator

    Swift: Expected ',' separator

    I get this error at

    i got other stuff in this class

    here is my code:

    import Foundation import UIKit import ObjectiveC

      class myMenuClass: UIViewController {
    
     @IBOutlet weak var wheel: UIImageView!
    
    @IBOutlet weak var spinValueLabel: UILabel!
    
    @IBOutlet weak var roundMenu: XXXRoundMenuButton!
    
    
    var spinnerView = SpinnerView(frame: CGRect.zero)
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        addSpinnerView()
        spinnerView.addOval()
        
        
        
        
        
        let roundMenu = XXXRoundMenuButton();
        self.view.addSubview(roundMenu);
        roundMenu.frame = CGRectMake(self.view.frame.size.width/2-100, self.view.frame.size.height/2-100, 200, 200);
        roundMenu.centerButtonSize = CGSizeMake(44, 44);
        roundMenu.tintColor = UIColor.whiteColor();
        roundMenu.jumpOutButtonOnebyOne = true;
        
        
        
        roundMenu.loadButtonWithIcons([UIImage(named: "icon_can")!,UIImage(named: "icon_pos")!,UIImage(named: "icon_img")!], startDegree: -M_PI, layoutDegree: M_PI/2);
        
        roundMenu.buttonClickBlock =  {(idx:NSInteger)-> Void in
            NSLog("%d", idx);
        };
    
    
        self.roundMenu.centerButtonSize = CGSizeMake(44, 44);
        self.roundMenu.centerIconType = XXXIconTypeUserDraw;
        self.roundMenu.tintColor = [UIColor whiteColor];
        self.roundMenu.jumpOutButtonOnebyOne = YES;
        
        [self.roundMenu setDrawCenterButtonIconBlock:^(CGRect rect, UIControlState state) {
            
            if (state == UIControlStateNormal)
            {
            UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 - 5, 15, 1)];
            [UIColor.whiteColor setFill];
            [rectanglePath fill];
            
            
            UIBezierPath* rectangle2Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2, 15, 1)];
            [UIColor.whiteColor setFill];
            [rectangle2Path fill];
            
            UIBezierPath* rectangle3Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 + 5, 15, 1)];
            [UIColor.whiteColor setFill];
            [rectangle3Path fill];
            }
            }];
        
        [self.roundMenu loadButtonWithIcons:@[
            [UIImage imageNamed:@"icon_can"],
            [UIImage imageNamed:@"icon_pos"],
            [UIImage imageNamed:@"icon_img"],
            [UIImage imageNamed:@"icon_can"],
            [UIImage imageNamed:@"icon_pos"],
            [UIImage imageNamed:@"icon_img"],
            [UIImage imageNamed:@"icon_can"],
            [UIImage imageNamed:@"icon_pos"],
            [UIImage imageNamed:@"icon_img"]
            
            ] startDegree:0 layoutDegree:M_PI*2*7/8];
        
        [self.roundMenu setButtonClickBlock:^(NSInteger idx) {
            
            NSLog(@"button %@ clicked !",@(idx));
            }];
        
        
        /**
         *  RoundMenu2 config
         */
        [self.roundMenu2 loadButtonWithIcons:@[
            [UIImage imageNamed:@"icon_can"],
            [UIImage imageNamed:@"icon_pos"],
            [UIImage imageNamed:@"icon_img"]
            
            ] startDegree:-M_PI layoutDegree:M_PI/2];
        [self.roundMenu2 setButtonClickBlock:^(NSInteger idx) {
            
            NSLog(@"button %@ clicked !",@(idx));
            }];
        
        self.roundMenu2.tintColor = [UIColor whiteColor];
        
        self.roundMenu2.mainColor = [UIColor colorWithRed:0.13 green:0.58 blue:0.95 alpha:1];
        
        
        
        
    
        
        
        
        
        
    }
        
        
        
        
        
    }
    
    override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func spinBuutonAction(_ sender: UIButton) {
        
        spinnerView.callSpinTimer()
    }
    
    func addSpinnerView() {
        let boxSize: CGFloat = 100.00
        spinnerView.frame = CGRect(x: view.bounds.width / 2 - boxSize / 2,
                                   y: view.bounds.height / 2 - boxSize / 2,
                                   width: boxSize,
                                   height: boxSize)
        spinnerView.parentFrame = view.frame
        spinnerView.delegate = self
        view.addSubview(spinnerView)
    }
    

    extension RouletteClass: spinnerProtocol {

    func spinValueAfterCompleteRoatation(value: Float) {
        
        let radianToDegree = Int(value * 180 / .pi)
        spinValueLabel.text = "\(radianToDegree)"
        
        
        
    }
    
    
    override open var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
    
    
    override open var prefersStatusBarHidden: Bool {
        return true
    }
    

    }

    opened by xousef 1
  • Center Icon

    Center Icon

    Did I miss it somewhere, but why can we define PNGs as all around buttons, but have to draw bezier curves for the center icon?

    I'd love to be able to just select a png as center icon as well...

    opened by DonBaronFactory 1
  • add hitTest to this library

    add hitTest to this library

    Hi, I'm trying to use this fabulous library with a large radius, in a way that icons would locate outside of the parent view, And as a result, they can't be clicked!!! how can I add HitTest function to this??

    opened by simaattar 5
Releases(1.0)
Owner
zsy78191
A coder like game
zsy78191
Slide-Menu - A Simple Slide Menu With Swift

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

Kirill 0 Jan 8, 2022
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

Cali Castle 1.5k Dec 30, 2022
iOS 7/8 style side menu with parallax effect.

RESideMenu iOS 7/8 style side menu with parallax effect inspired by Dribbble shots (first and second). Since version 4.0 you can add menu view control

Roman Efimov 7.2k Dec 28, 2022
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

Anatoliy Voropay 22 Dec 27, 2022
JNDropDownMenu - Easy to use TableView style dropdown menu.

Overview Swift version of https://github.com/dopcn/DOPDropDownMenu Easy to use TableView style dropdown menu. Setup The only thing you

Javal Nanda 65 Jun 27, 2021
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
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
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

null 10 Oct 7, 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
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

Toan Nguyen 114 Jun 12, 2022
⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Swift UI library made by @Ramotion

CIRCLE MENU Simple, elegant UI menu with a circular layout and material design animations We specialize in the designing and coding of custom UI for M

Ramotion 3.4k Dec 29, 2022
A simple side menu for iOS written in Swift.

ENSwiftSideMenu A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to

Evgeny Nazarov 1.8k Dec 21, 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
a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

lyricsify a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

Krisna Pranav 4 Sep 16, 2021
A simple dropdown menu component for iPhone

AZDropdownMenu AZDropdownMenu is a simple dropdown menu component that supports Swift. Screenshots Code used in the screencast are included in the bun

Wu 194 Nov 14, 2022
UIKit drop down menu, simple yet flexible and written in Swift

DropDownMenuKit DropDownMenuKit is a custom UIKit control to show a menu attached to the navigation bar or toolbar. The menu appears with a sliding an

Quentin Mathé 258 Dec 27, 2022
Simple and Elegant Drop down menu for iOS 🔥💥

SwiftyMenu is simple yet powerfull drop down menu component for iOS. It allow you to have drop down menu that doesn't appear over your views, which gi

Karim Ebrahem 502 Nov 29, 2022
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

null 62 Dec 11, 2022
A simple customizable side menu written in SwiftUI.

NSideMenu Description A simple customizable side menu written in SwiftUI. Give a Star! ⭐ Feel free to request an issue on github if you find bugs or r

null 5 Oct 10, 2022