Coder Social home page Coder Social logo

kjuly / kycirclemenu Goto Github PK

View Code? Open in Web Editor NEW
786.0 54.0 154.0 795 KB

An iOS UI control that allows you to build a circular menu by laying out buttons in a circle pattern adjusting from the number of buttons (1~6).

License: MIT License

Objective-C 97.19% Ruby 2.81%
ios objective-c menu

kycirclemenu's Introduction

KYCircleMenu

A circle menu with toggling animation. And you can customize the number of buttons between (1 ~ 6).

This control is separated from iPokeMon (a PokéMon game on iOS with Location Based Service), you can take a look at the demo video how cool it is!

Usage

Designated Initializer

Use the designated initializer below to initialize the circle menu:

// |buttonCount| : count of buttons around (1<= x <=6)
// |menuSize| : size of menu
// |buttonSize| : size of buttons around
// |buttonImageNameFormat| : name format for button image
// |centerButtonSize| : size of center button
// |centerButtonImageName| : name for center button image
// |centerButtonBackgroundImageName| : name for center button background image
- (id)      initWithButtonCount:(NSInteger)buttonCount
                       menuSize:(CGFloat)menuSize
                     buttonSize:(CGFloat)buttonSize
          buttonImageNameFormat:(NSString *)buttonImageNameFormat
               centerButtonSize:(CGFloat)centerButtonSize
          centerButtonImageName:(NSString *)centerButtonImageName
centerButtonBackgroundImageName:(NSString *)centerButtonBackgroundImageName;

Button Action

Override the -runButtonActions: message to customize your button action:

- (void)runButtonActions:(id)sender {
  [super runButtonActions:sender];

  // Do buttons' action appropriately by |[sender tag]|
  // ...
}

Tags are defined like below:

TAG:        1       1   2      1   2     1   2     1 2 3     1 2 3
           \|/       \|/        \|/       \|/       \|/       \|/
COUNT: 1) --|--  2) --|--   3) --|--  4) --|--  5) --|--  6) --|--
           /|\       /|\        /|\       /|\       /|\       /|\
TAG:                             3       3   4     4   5     4 5 6

Navigation Bar

The default case is that the navigation bar is only shown in child views. If you want it to be shown with the circle menu together, add the macro below

#define KY_CIRCLEMENU_WITH_NAVIGATIONBAR 1

to your constatns.h or config.h, or any other files that are imported in your <Project>-Prefix.pch.


License

This code is distributed under the terms and conditions of the MIT license.

kycirclemenu's People

Contributors

kjuly avatar macbuildserver 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  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

kycirclemenu's Issues

center/ipad/rotate

Is there a way to recenter on rotate, and center using this control on an ipad. can't seem to find a way to relayout on rotate

Add CircleMenuViewController into a ViewController

Hi,

As your demo you add CircleMenuViewController into AppDelegate. But in my case, I need to add CircleMenuViewController into my ViewController

Here us my code

@implementation SubmitListViewController

- (void)viewDidLoad
{
    //SubmitAdsViewController.delegate = self;
    // Circle Menu
    CircleMenuViewController * circleMenuViewController=
    [[CircleMenuViewController alloc]initWithButtonCount:kKYCCircleMenuButtonsCount
                                                menuSize:kKYCircleMenuSize
                                              buttonSize:kKYCircleMenuButtonSize
                                   buttonImageNameFormat:kKYICircleMenuButtonImageNameFormat
                                        centerButtonSize:kKYCircleMenuCenterButtonSize
                                   centerButtonImageName:kKYICircleMenuCenterButton
                         centerButtonBackgroundImageName:kKYICircleMenuCenterButtonBackground];
    [self.view addSubview:circleMenuViewController.view];
}

When I compile I got this error:
Undefined symbols for architecture i386:
"OBJC_CLASS$_CircleMenuViewController", referenced from:
objc-class-ref in SubmitListViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried to use KYCircleMenu.h directly instead of CircleMenuViewController , that works, but when I tap on the center button it crash as well.

Do you have any introduction for my case. Thanks in advance.

Can not change menu button size.

Hi,

I change kKYCircleMenuButtonSize from kKYButtonInNormalSize to kKYButtonInSmallSize, but it doesn't change anything.

Constrants.h

#define kKYCircleMenuButtonSize             kKYButtonInSmallSize
#define kKYCircleMenuCenterButtonSize kKYButtonInNormalSize

For menu items 7 to 8

Hi every one,
please tell me how to implement this control for 7 to 8 items so that i can use it into my app
Thanks in advance.

Warning Error: Unused Entity Issue Expression result unused

Hi Kaijie Yu, I copied the files of demo to new single view project, in iOS 6.1, I debugged the ARC errors, like memory release, but xcode showed me that warning error of the Designated Initializer in AppDelegate, I run the app and the simulator show me a black screen.

!Warning :Error: Unused Entity Issue Expression result unused

[circleMenuViewController initWithButtonCount:kKYCCircleMenuButtonsCount
                                                     menuSize:kKYCircleMenuSize
                                                    buttonSize:kKYCircleMenuButtonSize
                               buttonImageNameFormat:kKYICircleMenuButtonImageNameFormat
                                           centerButtonSize:kKYCircleMenuCenterButtonSize
                                centerButtonImageName:kKYICircleMenuCenterButton
               centerButtonBackgroundImageName:kKYICircleMenuCenterButtonBackground];

How can I create a button for my child view, so I can be able to return for the KYCircleMenu?

Hello, my name is Leal and I'm starting to play with the iOS apps. Trying to use this awesome UI Control, I'm in the obligation to mess with some files... ;-)
The first case below (1) is working fine (does not have nothing on the new view, but is working. I can click on the option 1, go to the new view, and do have a button to go back to the KYCircleMenu. But when I choose the option 2 (case 2), I can go to the google website, and it works fine. The problem is that I do not have the button to go back to the KYCircleMenu.

Here is the code:

#pragma mark - KYCircleMenu Button Action

// Run button action depend on their tags:
//
// TAG:        1       1   2      1   2     1   2     1 2 3     1 2 3
//            \|/       \|/        \|/       \|/       \|/       \|/
// COUNT: 1) --|--  2) --|--   3) --|--  4) --|--  5) --|--  6) --|--
//            /|\       /|\        /|\       /|\       /|\       /|\
// TAG:                             3       3   4     4   5     4 5 6
//
- (void)runButtonActions:(id)sender {
  [super runButtonActions:sender];
    switch ([sender tag]) {
        case 1: {
            // Do a thing
            // Configure new view & push it with custom |pushViewController:| method
            //NSLog(@"Debug - TAG: %d", [sender tag]);
            UIViewController *viewController = [[UIViewController alloc] init];
            [viewController.view setBackgroundColor:[UIColor blackColor]];
            [viewController setTitle:[NSString stringWithFormat:@"Cadastro"]];
            // Use KYCircleMenu's |-pushViewController:| to push vc
            [self pushViewController:viewController];
            [viewController release];
        }
            break;

        case 2: {
            // Initializing the UIWebView interface...
            UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
            webView.userInteractionEnabled = YES;
            NSString *urlAddress = @"http://www.google.com";
            // NSLog(@"Debug - We should open the URL: %@", urlAddress);
            NSURL *url = [NSURL URLWithString:urlAddress];
            NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
            //[webView.scrollView flashScrollIndicators];
            //Load the request in the UIWebView.
            [webView loadRequest:requestObj];
            [self.view addSubview:webView];
            [webView release];
        }
            break;

        case 3:
            // Just logging for now...
            // NSLog(@"Debug - TAG: %d", [sender tag]);
            break;

        case 4:
            // Just logging for now...
            // NSLog(@"Debug - TAG: %d", [sender tag]);
            break;

        case 5:
            // Just logging for now...
            // NSLog(@"Debug - TAG: %d", [sender tag]);
            break;

        case 6:
            // Just logging for now...
            // NSLog(@"Debug - TAG: %d", [sender tag]);
            break;

        default:
            // We should not be here...
            break;
    }
}

@end

Problem on iOS7

Hello,

When I test the KYCirleMenu on IOS7. I get a white screen.
Any idea where the problem is situated?

How To Call your viewcontroller from KYCircularMenu and Mantain your look and feel

I downloaded de CirculesMenu and I successfully implement in my app but I am stock in how to show the other ViewControllers in my apps. I can call the other VC with these code

- (void)runButtonActions:(id)sender {
  [super runButtonActions:sender];

  if ([sender tag] == 1)
  {
    // Configure new view & push it with custom |pushViewController:| method
    MusicViewController *MviewController = [[MusicViewController alloc] init];
    //UIViewController * viewController = [[UIViewController alloc] init];
    //[viewController.view setBackgroundColor:[UIColor blackColor]];
    [MviewController setTitle:[NSString stringWithFormat:@"Música"]];
    // Use KYCircleMenu's |-pushViewController:| to push vc
    [self pushViewController:MviewController];
  }

My viewDidLoad code

- (void)viewDidLoad
{
  [super viewDidLoad];
  // Do any additional setup after loading the view.

  // Setting Up Activity Indicator View
  self.activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
  self.activityIndicatorView.hidesWhenStopped = YES;
  self.activityIndicatorView.center = self.view.center;
  [self.view addSubview:self.activityIndicatorView];
  [self.activityIndicatorView startAnimating];

  // Initializing Data Source
  NSURL *url = [NSURL URLWithString:StrJsonURL];
  NSURLRequest *request = [NSURLRequest requestWithURL:url];
  AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id getJSON) {
    _JSON = getJSON;
    [self.activityIndicatorView stopAnimating];
    NSLog(@"%@", _JSON);
    [self.tableView reloadData];
  } failure:nil];
  [operation start];
}

Not loadview code yet implemented

Choosing multple option at a time.

i can choose more than 1 option at a time ,which must not be there.(monkey testing)

Kindly give me a solution (only last selection ,or single selection)

Customisation with Storyboard

hi @Kjuly !

I'm trying to using your library for a personal application in Swift and i would like to know, how can i use KYCircleMenu with Storyboard for more customization.

I'm trying to work only with the subview of KYCircleMenu but it does not work .... .

Any idea ?

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.