Giter VIP home page Giter VIP logo

jamesmura / cdpiemenu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wokalski/piemenu

0.0 2.0 0.0 224 KB

Fully and easily customizable rotary wheel control also called pie menu for iPhone and iPad. Very similar to the control in Convertbot. As the only one in the internet it rotates with inertia/mementum. Drawn using CoreGraphics without any images.

Objective-C 98.25% Ruby 1.75%

cdpiemenu's Introduction

CDPieMenu by Wojtek Czekalski (wczekalski)

CDPieMenu

##Planned improvements:

  • adding and removing thumbs during runtime.

I'll be glad to hear your requests

View Hierarchy

  • CDCircle - is a UIView subclass. It's, let's say, the base of a CDPieMenu. It's a circle drawn using CoreGraphics/QuartzCore.

  • CDCircleThumb - UIView subclass, is a single segment in a CDPieMenu. It's subview of a CDCircle. Highly customisable. More information about modifying a thumb is listed below.

  • CDIconView - UIImageView subclass, it handles colouring of an icon. CDIconView is subview of a CDCircleThumb.

  • CDCircleOverlayView - this is independent view outside of the main view hierarchy. It handles selection of a thumb. It cannot be subview of a CDCircle because then, it would turn around with a circle.

Methods

#####CDCircle

  • -(id)initWithFrame:(CGRect) frame numberOfSegments:(NSUInteger) nSegments ringWidth:(CGFloat) ringWidth

#####Delegate:

  • -(void) circle:(CDCircle *)circle didMoveToSegment:(NSInteger)segment thumb:(CDCircleThumb *)thumb

#####Data source:

  • -(UIImage *) circle:(CDCircle *)circle iconForThumbAtRow:(NSInteger)row

#####CDCircleOverlayView

  • -(id) initWithCircle:(CDCircle) circle

Properties

#####CDCircle:

  • dataSource - data source of CDPieMenu.
  • delegate - delegate of CDPieMenu
  • (UIColor *) circleColor - Set this property to change color of a circle. It may be usable when you want to achieve specyfic effect (e.g. semi transparent thumbs, and coloured circle will create some effect)
  • (NSArray *) thumbs - all thumbs.
  • (CDCircleOverlayView *) overlayView - a pointer to CDCircleOverlayView
  • (BOOL) inertiaEffect - it determines appearance of additional rotation after the last touch.

#####CDCircleThumb:

  • (CDIconView *)iconView - a pointer to thumb's CDIconView
  • (UIColor *)separatorColor - color of a separator
  • separatorStyle - it can be CDCircleThumbsSeparatorNone or CDCircleThumbsSeparatorBasic. Style of a separator.
  • (BOOL)gradientFill - If gradientFill is set to NO, a thumb is coloured with solid color
  • (NSArray *) gradientColors - colors of thumb's gradient.
  • (NSArray *) colorsLocations - locations of colors in a gradient
  • (UIColor *) arcColor - if gradientFill is set to 'NO' we can set thumb's color using this property.

###CDIconView:

  • highlitedIconColor - color of an image when a thumb is selected

###CDCircleOverlayView:

  • overlayThumb - pointer to a thumb which is the selector (central thumb)

Samples

Use this code to implement standard CDPieMenu:

 CDCircle *circle = [[CDCircle alloc] initWithFrame:CGRectMake(10 , 90, 300, 300) numberOfSegments:6 ringWidth:80.f];
circle.dataSource = self;
circle.delegate = self;
CDCircleOverlayView *overlay = [[CDCircleOverlayView alloc] initWithCircle:circle];
[self.view addSubview:circle];
//Overlay cannot be subview of a circle because then it would turn around with the circle
[self.view addSubview:overlay];

CDPieMenu

Code used to achieve effect shown above :

circle.overlayView.overlayThumb.arcColor = [UIColor colorWithRed:0.00f green:1.00f blue:0.25f alpha:0.4];

CDPieMenu

Code used to achieve effect shown above :

for (CDCircleThumb *thumb in circle.thumbs) {
[thumb.iconView setHighlitedIconColor:[UIColor redColor]];
 thumb.separatorColor = [UIColor whiteColor];
 thumb.separatorStyle = CDCircleThumbsSeparatorBasic;
 thumb.gradientFill = NO;
 thumb.arcColor = [UIColor greenColor];
 
  }

How to use CDPieMenu

In order to use CDPieMenu add following frameworks to your project:

  • CoreGraphics
  • QuartzCore

License

CDPieMenu is licensed under MIT license

CDPieMenu has been mentioned on:

Thank you guys for promotion

###About me:

If you have got any question, feel free to mail me at [email protected]

Twitter @wczekalski

cdpiemenu's People

Contributors

alvesjtiago avatar bartvandendriessche avatar jamesmura avatar wokalski avatar

Watchers

 avatar  avatar

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.