Git Product home page Git Product logo

xxxroundmenubutton's Introduction

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];

xxxroundmenubutton's People

Contributors

heropd avatar hzhou81 avatar zsy78191 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xxxroundmenubutton's Issues

Center button position

How to change the center button position to top left as well as the item positions consecutively.

addon

@GoogleSignInClientEmoji Editor 2020-12-02_18-28-49~2.pngreceived_387690219317172.mp4128793641_142538273937415_8718048129336024015_n.jpeg129163235_135798598062269_7653185220925077204_n.jpegreceived_395777574881405.jpegreceived_395777574881405.jpegeb-931a-fc8b82ead0e6.jpeg

Swift help

Hi, I love the look of this! Could you please add some instructions for how to use this in a Swift-based project? I'd really appreciate it!

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?

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
}

}

inappropriate porn

[Inappropriate]
#Spam
(ISIS user)
////////////////////////////
Insulting the presidency, insulting the president and the country's politics, insulting the Iranian government, insulting the type of Iranian nationality, insulting Khamenei
https://web.rubika.ir/#c=u0EvUco06d7b00fe3d9201ce163d5c9c
Screenshot_۲۰۲۴۰۸۰۶-۱۸۰۸۵۱_Telegram.jpg
[Insulting and humiliating the government of Iran, insulting the leader of the Islamic Republic of Iran, editing images of Imam Khamenei in an obscene manner and inserting his photo in channels and groups and humiliating Iran. Government by ugliness and theft. Obscenity against the IRGC and the regime of Iran, insulting the government of Iran and the type of Iranian nationality, obscene insults and posting obscene and obscene content in terrorist and anti-revolutionary channels, harmful activity and filtering]
Screenshot_۲۰۲۴۰۸۰۶-۱۷۵۶۴۴_Telegram.jpg
Screenshot_۲۰۲۴۰۸۰۶-۱۷۵۶۱۴_Telegram.jpg

Bar button

is possible to add this effect in a bar button item?

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.

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?

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??

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?

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?

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.