Skip to content
Amazing animations available with MagicPie!
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MagicPie.xcodeproj - Add simple pie view example in swift May 17, 2015
MagicPie - Add simple pie view example in swift May 17, 2015
MagicPieLayer - Fix warning Oct 4, 2016
MagicPieTests
.gitignore Initial commit Oct 11, 2013
LICENSE Initial commit Oct 11, 2013
MagicPie.gif Add example demo .gif Oct 11, 2013
MagicPie.podspec - Fix animate changes when scroll is dragging Oct 4, 2016
MagicPie2.gif - refactor - add examples Dec 30, 2013
MagicPie3.gif - Add one more example Jan 19, 2014
MagicPie4.gif - Add documentation and example in Swift Feb 15, 2015
README.md - Add simple pie view example in swift May 17, 2015

README.md

MagicPie

Powerful pie layer for creating your own pie view. PieLayer provide great animation with simple usage.

The main advantage of that control that there is no worry about displaying of animation. Animation will display correctly even if you will add new elements during execution of another slice deleting animation. That's amazing! And here is no delegates. I like delegates, but in this case I think they are excess.

Demo

Demo

Be creative =)

Demo

Demo

Installation

Edit your PodFile to include the following line:

pod 'MagicPie'

Then import the main header.

#import <MagicPieLayer.h>

Have a fun!

Swift Swift Swift Swift Swift

Okay, now when you are reading this, I recommend to you look the example #2 in Swift.

Example Usage

Create pie:

Obj-C
PieLayer* pieLayer = [[PieLayer alloc] init];
pieLayer.frame = CGRectMake(0, 0, 200, 200);
[self.view.layer addSublayer:pieLayer];
Swift
let pieLayer = PieLayer()
pieLayer.frame = CGRectMake(0, 0, 200, 200)
view.layer.addSublayer(pieLayer)

Add slices:

Obj-C
[pieLayer addValues:@[[PieElement pieElementWithValue:5.0 color:[UIColor redColor]],
                      [PieElement pieElementWithValue:4.0 color:[UIColor blueColor]],
                      [PieElement pieElementWithValue:7.0 color:[UIColor greenColor]]] animated:YES];
Swift
pieLayer.addValues([PieElement(value: 5.0, color: UIColor.redColor()),
                    PieElement(value: 4.0, color: UIColor.blueColor()),
                    PieElement(value: 7.0, color: UIColor.greenColor())], animated: true)

Change value with animation:

Obj-C
PieElement* pieElem = pieLayer.values[0];
[PieElement animateChanges:^{
	pieElem.val = 13.0;
	pieElem.color = [UIColor yellowColor];
}];
Swift
let pieElem = pieLayer.values[0]
PieElement.animateChanges {
	pieElem.val = 13.0
	pieElem.color = UIColor.yellowColor()
}

Delete slices:

Obj-C
[pieLayer deleteValues:@[pieLayer.values[0], pieLayer.values[1]] animated:YES];
Swift
pieLayer.deleteValues([pieLayer.values[0], pieLayer.values[1]], animated: true)

Contact

Alexandr Graschenkov: alexandr.graschenkov91@gmail.com

License

MagicPie is available under the MIT license.

Copyright © 2013 Alexandr Graschenkov.

You can’t perform that action at this time.