├── screenshot.png ├── CirclePercent.gif ├── DrawCircleAnimation.xcodeproj ├── xcuserdata │ ├── Khoi.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── DrawCircleAnimation.xcscheme │ └── admin.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── DrawCircleAnimation.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── Khoi.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── admin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── project.pbxproj ├── DrawCircleAnimation ├── ViewController.h ├── AppDelegate.h ├── main.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── KNCirclePercentView │ ├── KNPercentLabel.h │ ├── KNCirclePercentView.h │ ├── KNPercentLabel.m │ └── KNCirclePercentView.m ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── AppDelegate.m └── ViewController.m └── README.md /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knn90/KNCirclePercentView/HEAD/screenshot.png -------------------------------------------------------------------------------- /CirclePercent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knn90/KNCirclePercentView/HEAD/CirclePercent.gif -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/Khoi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/project.xcworkspace/xcuserdata/Khoi.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knn90/KNCirclePercentView/HEAD/DrawCircleAnimation.xcodeproj/project.xcworkspace/xcuserdata/Khoi.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knn90/KNCirclePercentView/HEAD/DrawCircleAnimation.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DrawCircleAnimation/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/23/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /DrawCircleAnimation/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/23/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /DrawCircleAnimation/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/23/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/Khoi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawCircleAnimation.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D6B7A0ED1C02FCAD0033A9E2 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawCircleAnimation.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D6B7A0ED1C02FCAD0033A9E2 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DrawCircleAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /DrawCircleAnimation/KNCirclePercentView/KNPercentLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TweenLabel.h 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/25/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class KNPercentLayer; 13 | @protocol KNPercentDelegate; 14 | 15 | @interface KNPercentLabel : NSObject 16 | @property (strong, nonatomic) CAMediaTimingFunction *timingFunction; 17 | 18 | - (instancetype)initWithObject:(UIView *)object key:(NSString *)key from:(CGFloat)fromValue to:(CGFloat)toValue duration:(NSTimeInterval)duration; 19 | 20 | - (void)start; 21 | @end 22 | 23 | @interface KNPercentLayer : CALayer 24 | 25 | @property (weak, nonatomic) id tweenDelegate; 26 | @property (nonatomic) CGFloat fromValue; 27 | @property (nonatomic) CGFloat toValue; 28 | @property (nonatomic) NSTimeInterval tweenDuration; 29 | 30 | - (instancetype)initWithFromValue:(CGFloat)fromValue toValue:(CGFloat)toValue duration:(CGFloat)duration; 31 | - (void)startAnimation; 32 | @end 33 | 34 | @protocol KNPercentDelegate 35 | 36 | - (void)layer:(KNPercentLayer *)layer didSetAnimationPropertyTo:(CGFloat)toValue; 37 | - (void)layerDidStopAnimation; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /DrawCircleAnimation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /DrawCircleAnimation/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DrawCircleAnimation/KNCirclePercentView/KNCirclePercentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CirclePercentView.h 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/24/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KNPercentLabel.h" 11 | 12 | typedef enum { 13 | CirclePercentTypeLine = 0, 14 | CirclePercentTypePie 15 | } CirclePercentType; 16 | 17 | @interface KNCirclePercentView : UIView 18 | 19 | @property (nonatomic, strong) NSString *key; 20 | @property (nonatomic, strong) CAMediaTimingFunction *timingFunction; 21 | @property (nonatomic, strong) UILabel *percentLabel; 22 | 23 | /* 24 | * Auto calculated radius base on View's frame 25 | * 26 | * @param percent percent of circle to display 27 | * @param lineWidth witdth of circle 28 | * @param clockwise determine clockwise 29 | * @param fillColor color inside cricle 30 | * @param strokeColor color of circle line 31 | * @param animatedColors colors array to animated. if this param is nil, Stroke color will be used to draw circle 32 | */ 33 | 34 | - (void)drawCircleWithPercent:(CGFloat)percent 35 | duration:(CGFloat)duration 36 | lineWidth:(CGFloat)lineWidth 37 | clockwise:(BOOL)clockwise 38 | lineCap:(NSString *)lineCap 39 | fillColor:(UIColor *)fillColor 40 | strokeColor:(UIColor *)strokeColor 41 | animatedColors:(NSArray *)colors; 42 | 43 | - (void)drawPieChartWithPercent:(CGFloat)percent 44 | duration:(CGFloat)duration 45 | clockwise:(BOOL)clockwise 46 | fillColor:(UIColor *)fillColor 47 | strokeColor:(UIColor *)strokeColor 48 | animatedColors:(NSArray *)colors; 49 | 50 | /* 51 | * Start draw animation 52 | */ 53 | - (void)startAnimation; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /DrawCircleAnimation/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/23/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KNCirclePercentView 2 | A custom animated circle percent view 3 | 4 | ## Usage 5 | 1. Add KNCirclePercentView using storyboard/nib/code 6 | 2. Call Methods: 7 | ```Objective-C 8 | /** 9 | * Draw Circle with specified radius 10 | * 11 | * @param radius radius of circle view 12 | * @param percent percent of circle to display 13 | * @param lineWidth circle thickness 14 | * @param clockwise determine clockwise 15 | * @param fillColor color inside circle 16 | * @param strokeColor color of circle line 17 | * @param animatedColors colors array to animated. if this param is nil, Stroke color will be used to draw circle 18 | */ 19 | 20 | - (void)drawCircleWithRadius:(CGFloat)radius 21 | percent:(CGFloat)percent 22 | duration:(CGFloat)duration 23 | lineWidth:(CGFloat)lineWidth 24 | clockwise:(BOOL)clockwise 25 | fillColor:(UIColor *)fillColor 26 | strokeColor:(UIColor *)strokeColor 27 | animatedColors:(NSArray *)colors; 28 | 29 | - (void)startAnimation; 30 | ``` 31 | 32 | ## Screenshot 33 | ### iPhone 34 | 35 | ![](CirclePercent.gif) 36 | ##License 37 | The MIT License (MIT) 38 | 39 | Copyright (c) 2015 Khoi Nguyen 40 | 41 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 46 | 47 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/Khoi.xcuserdatad/xcschemes/DrawCircleAnimation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/DrawCircleAnimation.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DrawCircleAnimation/KNCirclePercentView/KNPercentLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // TweenLabel.m 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/25/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import "KNPercentLabel.h" 10 | 11 | @interface KNPercentLabel() 12 | 13 | @property (strong, nonatomic) KNPercentLayer *layer; 14 | @property (strong, nonatomic) UIView *object; 15 | @property (strong, nonatomic) NSString *key; 16 | 17 | @end 18 | 19 | @implementation KNPercentLabel 20 | 21 | - (instancetype)initWithObject:(UIView *)object key:(NSString *)key from:(CGFloat)fromValue to:(CGFloat)toValue duration:(NSTimeInterval)duration { 22 | self = [super init]; 23 | if (self) { 24 | self.object = object; 25 | self.key = key; 26 | self.layer = [[KNPercentLayer alloc] init]; 27 | self.layer.fromValue = fromValue; 28 | self.layer.toValue = toValue; 29 | self.layer.tweenDuration = duration; 30 | self.layer.tweenDelegate = self; 31 | [self.object.layer addSublayer:self.layer]; 32 | } 33 | return self; 34 | } 35 | 36 | - (void)start { 37 | [self.layer startAnimation]; 38 | } 39 | 40 | - (void)layer:(KNPercentLayer *)layer didSetAnimationPropertyTo:(CGFloat)toValue { 41 | int percent = (int)toValue; 42 | NSString *text = [NSString stringWithFormat:@"%2d%%", percent]; 43 | [self.object setValue:text forKey:self.key]; 44 | } 45 | 46 | - (void)layerDidStopAnimation { 47 | int percent = (int)self.layer.toValue; 48 | NSString *text = [NSString stringWithFormat:@"%2d%%", percent]; 49 | [self.object setValue:text forKey:self.key]; 50 | [self.layer removeFromSuperlayer]; 51 | } 52 | @end 53 | 54 | 55 | //=============================================================// 56 | @interface KNPercentLayer() 57 | 58 | @property (nonatomic) CGFloat animatableProperty; 59 | @property (nonatomic) CGFloat delay; 60 | @property (strong, nonatomic) UIColor *color; 61 | @property (strong, nonatomic) CAMediaTimingFunction *timingFunction; 62 | 63 | @end 64 | 65 | @implementation KNPercentLayer 66 | 67 | @dynamic animatableProperty; 68 | @dynamic color; 69 | 70 | - (instancetype)initWithFromValue:(CGFloat)fromValue toValue:(CGFloat)toValue duration:(CGFloat)duration { 71 | self = [super init]; 72 | if (self) { 73 | self.fromValue = fromValue; 74 | self.toValue = toValue; 75 | self.duration = duration; 76 | } 77 | return self; 78 | } 79 | 80 | + (BOOL)needsDisplayForKey:(NSString *)key { 81 | 82 | if ([key isEqualToString:@"animatableProperty"] || [key isEqualToString:@"color"]) { 83 | return YES; 84 | } else { 85 | return [super needsDisplayForKey:key]; 86 | } 87 | } 88 | 89 | - (id)actionForKey:(NSString *)event { 90 | if (![event isEqualToString:@"animatableProperty"] && ![event isEqualToString:@"color"]) { 91 | return [super animationForKey:event]; 92 | } 93 | 94 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:event]; 95 | animation.timingFunction = self.timingFunction; 96 | animation.fromValue = [NSNumber numberWithFloat:self.fromValue]; 97 | animation.toValue = [NSNumber numberWithFloat:self.toValue]; 98 | animation.duration = self.tweenDuration; 99 | animation.beginTime = CACurrentMediaTime() + self.delay; 100 | animation.delegate = self; 101 | 102 | return animation; 103 | } 104 | 105 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag { 106 | [self.tweenDelegate layerDidStopAnimation]; 107 | } 108 | 109 | - (void)display { 110 | if (self.presentationLayer != nil) { 111 | KNPercentLayer *tweenLayer = (KNPercentLayer *)self.presentationLayer; 112 | [self.tweenDelegate layer:self didSetAnimationPropertyTo:tweenLayer.animatableProperty]; 113 | } 114 | } 115 | 116 | - (void)startAnimation { 117 | self.animatableProperty = self.toValue; 118 | } 119 | @end -------------------------------------------------------------------------------- /DrawCircleAnimation/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/23/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "KNCirclePercentView.h" 11 | 12 | @interface ViewController() 13 | @property (weak, nonatomic) IBOutlet KNCirclePercentView *circleView; 14 | @property (weak, nonatomic) IBOutlet KNCirclePercentView *autoCalculateCircleView; 15 | @property (weak, nonatomic) IBOutlet UIButton *reset; 16 | @property (weak, nonatomic) IBOutlet UILabel *radiusLabel; 17 | @property (weak, nonatomic) IBOutlet UITextField *textField; 18 | 19 | 20 | 21 | @end 22 | 23 | @implementation ViewController 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | // Do any additional setup after loading the view, typically from a nib. 28 | } 29 | 30 | - (void)viewDidAppear:(BOOL)animated { 31 | [super viewDidAppear:animated]; 32 | self.radiusLabel.text = @"Pie Chart"; 33 | [self.circleView drawPieChartWithPercent:100 34 | duration:2 35 | clockwise:YES 36 | fillColor:[UIColor clearColor] 37 | strokeColor:[UIColor orangeColor] 38 | animatedColors:@[[UIColor greenColor], 39 | [UIColor yellowColor], 40 | [UIColor orangeColor], 41 | [UIColor redColor]]]; 42 | self.circleView.percentLabel.font = [UIFont systemFontOfSize:35]; 43 | 44 | // Auto calculate radius 45 | [self.autoCalculateCircleView drawCircleWithPercent:100 46 | duration:2 47 | lineWidth:15 48 | clockwise:YES 49 | lineCap:kCALineCapRound 50 | fillColor:[UIColor clearColor] 51 | strokeColor:[UIColor orangeColor] 52 | animatedColors:nil]; 53 | self.autoCalculateCircleView.percentLabel.font = [UIFont systemFontOfSize:35]; 54 | 55 | [self.circleView startAnimation]; 56 | [self.autoCalculateCircleView startAnimation]; 57 | 58 | self.textField.delegate = self; 59 | 60 | } 61 | 62 | - (void)didReceiveMemoryWarning { 63 | [super didReceiveMemoryWarning]; 64 | // Dispose of any resources that can be recreated. 65 | } 66 | - (IBAction)resetAction:(id)sender { 67 | [self.textField resignFirstResponder]; 68 | int percent = [self.textField.text intValue]; 69 | if (percent > 100) { 70 | percent = 100; 71 | } 72 | [self.circleView drawPieChartWithPercent:percent 73 | duration:2 74 | clockwise:YES 75 | fillColor:[UIColor clearColor] 76 | strokeColor:[UIColor orangeColor] 77 | animatedColors:@[[UIColor greenColor], 78 | [UIColor yellowColor], 79 | [UIColor orangeColor], 80 | [UIColor redColor]]]; 81 | [self.circleView startAnimation]; 82 | 83 | [self.autoCalculateCircleView drawCircleWithPercent:percent 84 | duration:2 85 | lineWidth:15 86 | clockwise:YES 87 | lineCap:kCALineCapRound 88 | fillColor:[UIColor clearColor] 89 | strokeColor:[UIColor orangeColor] 90 | animatedColors:nil]; 91 | [self.autoCalculateCircleView startAnimation]; 92 | } 93 | 94 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 95 | { 96 | NSCharacterSet *numbersOnly = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"]; 97 | NSCharacterSet *characterSetFromTextField = [NSCharacterSet characterSetWithCharactersInString:textField.text]; 98 | 99 | BOOL stringIsValid = [numbersOnly isSupersetOfSet:characterSetFromTextField]; 100 | return stringIsValid; 101 | } 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /DrawCircleAnimation/KNCirclePercentView/KNCirclePercentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CirclePercentView.m 3 | // DrawCircleAnimation 4 | // 5 | // Created by Khoi Nguyen Nguyen on 11/24/15. 6 | // Copyright © 2015 Khoi Nguyen Nguyen. All rights reserved. 7 | // 8 | 9 | #import "KNCirclePercentView.h" 10 | 11 | #define kStartAngle -M_PI_2 12 | 13 | @interface KNCirclePercentView() 14 | 15 | @property (nonatomic, strong) CAShapeLayer *backgroundLayer; 16 | @property (nonatomic, strong) CAShapeLayer *circle; 17 | @property (nonatomic) CGPoint centerPoint; 18 | @property (nonatomic) CGFloat duration; 19 | @property (nonatomic) CGFloat percent; 20 | @property (nonatomic) CGFloat radius; 21 | @property (nonatomic) CGFloat lineWidth; 22 | @property (nonatomic) NSString *lineCap; // kCALineCapButt, kCALineCapRound, kCALineCapSquare 23 | @property (nonatomic) BOOL clockwise; 24 | @property (nonatomic, strong) NSMutableArray *colors; 25 | @end 26 | 27 | @implementation KNCirclePercentView 28 | 29 | 30 | - (instancetype)initWithFrame:(CGRect)frame 31 | { 32 | self = [super initWithFrame:frame]; 33 | if (self) { 34 | [self commonInit]; 35 | } 36 | return self; 37 | } 38 | 39 | - (void)awakeFromNib { 40 | [self commonInit]; 41 | } 42 | 43 | - (void)commonInit { 44 | self.backgroundLayer = [CAShapeLayer layer]; 45 | [self.layer addSublayer:self.backgroundLayer]; 46 | 47 | self.circle = [CAShapeLayer layer]; 48 | [self.layer addSublayer:self.circle]; 49 | 50 | self.percentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width / 2, self.frame.size.height / 2)]; 51 | [self addSubview:self.percentLabel]; 52 | 53 | self.colors = [NSMutableArray new]; 54 | } 55 | 56 | - (void)drawCircleWithPercent:(CGFloat)percent 57 | duration:(CGFloat)duration 58 | lineWidth:(CGFloat)lineWidth 59 | clockwise:(BOOL)clockwise 60 | lineCap:(NSString *)lineCap 61 | fillColor:(UIColor *)fillColor 62 | strokeColor:(UIColor *)strokeColor 63 | animatedColors:(NSArray *)colors { 64 | 65 | self.duration = duration; 66 | self.percent = percent; 67 | self.lineWidth = lineWidth; 68 | self.clockwise = clockwise; 69 | [self.colors removeAllObjects]; 70 | if (colors != nil) { 71 | for (UIColor *color in colors) { 72 | [self.colors addObject:(id)color.CGColor]; 73 | } 74 | } else { 75 | [self.colors addObject:(id)strokeColor.CGColor]; 76 | } 77 | 78 | CGFloat min = MIN(self.frame.size.width, self.frame.size.height); 79 | self.radius = (min - lineWidth) / 2; 80 | self.centerPoint = CGPointMake(self.frame.size.width / 2 - self.radius, self.frame.size.height / 2 - self.radius); 81 | self.lineCap = lineCap; 82 | 83 | [self setupBackgroundLayerWithFillColor:fillColor]; 84 | [self setupCircleLayerWithStrokeColor:strokeColor]; 85 | [self setupPercentLabel]; 86 | } 87 | 88 | - (void)drawPieChartWithPercent:(CGFloat)percent 89 | duration:(CGFloat)duration 90 | clockwise:(BOOL)clockwise 91 | fillColor:(UIColor *)fillColor 92 | strokeColor:(UIColor *)strokeColor 93 | animatedColors:(NSArray *)colors { 94 | 95 | self.duration = duration; 96 | self.percent = percent; 97 | self.clockwise = clockwise; 98 | [self.colors removeAllObjects]; 99 | if (colors != nil) { 100 | 101 | for (UIColor *color in colors) { 102 | [self.colors addObject:(id)color.CGColor]; 103 | } 104 | } else { 105 | [self.colors addObject:(id)strokeColor.CGColor]; 106 | } 107 | 108 | CGFloat min = MIN(self.frame.size.width, self.frame.size.height); 109 | self.lineWidth = min / 2; 110 | self.radius = (min - self.lineWidth) / 2; 111 | self.centerPoint = CGPointMake(self.frame.size.width / 2 - self.radius, self.frame.size.height / 2 - self.radius); 112 | self.lineCap = kCALineCapButt; 113 | 114 | [self setupBackgroundLayerWithFillColor:fillColor]; 115 | [self setupCircleLayerWithStrokeColor:strokeColor]; 116 | [self setupPercentLabel]; 117 | } 118 | 119 | - (void)setupBackgroundLayerWithFillColor:(UIColor *)fillColor { 120 | 121 | self.backgroundLayer.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.radius, self.radius) radius:self.radius startAngle:kStartAngle endAngle:2*M_PI clockwise:self.clockwise].CGPath; 122 | 123 | // Center the shape in self.view 124 | self.backgroundLayer.position = self.centerPoint; 125 | 126 | // Configure the apperence of the circle 127 | self.backgroundLayer.fillColor = fillColor.CGColor; 128 | self.backgroundLayer.strokeColor = [UIColor lightGrayColor].CGColor; 129 | self.backgroundLayer.lineWidth = self.lineWidth; 130 | self.backgroundLayer.lineCap = self.lineCap; 131 | self.backgroundLayer.rasterizationScale = 2 * [UIScreen mainScreen].scale; 132 | self.backgroundLayer.shouldRasterize = YES; 133 | 134 | } 135 | 136 | - (void)setupCircleLayerWithStrokeColor:(UIColor *)strokeColor { 137 | // Set up the shape of the circle 138 | 139 | CGFloat endAngle = [self calculateToValueWithPercent:self.percent]; 140 | 141 | // Make a circular shape 142 | self.circle.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.radius, self.radius) radius:self.radius startAngle:kStartAngle endAngle:endAngle clockwise:self.clockwise].CGPath; 143 | 144 | // Center the shape in self.view 145 | 146 | self.circle.position = self.centerPoint; 147 | 148 | // Configure the apperence of the circle 149 | self.circle.fillColor = [UIColor clearColor].CGColor; 150 | self.circle.strokeColor = strokeColor.CGColor; 151 | self.circle.lineWidth = self.lineWidth; 152 | self.circle.lineCap = self.lineCap; 153 | self.circle.shouldRasterize = YES; 154 | self.circle.rasterizationScale = 2 * [UIScreen mainScreen].scale; 155 | 156 | } 157 | 158 | - (void)setupPercentLabel { 159 | 160 | NSLayoutConstraint *centerHor = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.percentLabel attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]; 161 | NSLayoutConstraint *centerVer = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.percentLabel attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]; 162 | 163 | self.percentLabel.translatesAutoresizingMaskIntoConstraints = NO; 164 | [self addConstraints:@[centerHor, centerVer]]; 165 | [self layoutIfNeeded]; 166 | self.percentLabel.text = [NSString stringWithFormat:@"%d%%", (int)self.percent]; 167 | } 168 | 169 | - (void)startAnimation { 170 | [self drawBackgroundCircle]; 171 | [self drawCircle]; 172 | KNPercentLabel *tween = [[KNPercentLabel alloc] initWithObject:self.percentLabel key:@"text" from:0 to:self.percent duration:self.duration]; 173 | tween.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 174 | [tween start]; 175 | } 176 | 177 | - (void)drawCircle { 178 | 179 | [self.circle removeAllAnimations]; 180 | 181 | // Configure animation 182 | CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 183 | drawAnimation.duration = self.duration; // "animate over 10 seconds or so.." 184 | drawAnimation.repeatCount = 1.0; // Animate only once.. 185 | 186 | // Animate from no part of the stroke being drawn to the entire stroke being drawn 187 | drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; 188 | drawAnimation.toValue = [NSNumber numberWithFloat:1.0f]; 189 | 190 | // Experiment with timing to get the appearence to look the way you want 191 | drawAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 192 | 193 | // Add the animation to the circle 194 | [self.circle addAnimation:drawAnimation forKey:@"drawCircleAnimation"]; 195 | 196 | CAKeyframeAnimation *colorsAnimation = [CAKeyframeAnimation animationWithKeyPath:@"strokeColor"]; 197 | colorsAnimation.values = self.colors; 198 | // colorsAnimation.keyTimes = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.3], [NSNumber numberWithFloat:0.8], [NSNumber numberWithFloat:1.0], nil]; 199 | colorsAnimation.calculationMode = kCAAnimationPaced; 200 | colorsAnimation.removedOnCompletion = NO; 201 | colorsAnimation.fillMode = kCAFillModeForwards; 202 | colorsAnimation.duration = self.duration; 203 | 204 | [self.circle addAnimation:colorsAnimation forKey:@"strokeColor"]; 205 | } 206 | 207 | - (void)drawBackgroundCircle { 208 | [self.backgroundLayer removeAllAnimations]; 209 | 210 | // Configure animation 211 | CABasicAnimation *drawAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 212 | drawAnimation.duration = self.duration; // "animate over 10 seconds or so.." 213 | drawAnimation.repeatCount = 1.0; // Animate only once.. 214 | 215 | // Animate from no part of the stroke being drawn to the entire stroke being drawn 216 | drawAnimation.fromValue = [NSNumber numberWithFloat:0.0f]; 217 | drawAnimation.toValue = [NSNumber numberWithFloat:1.0f]; 218 | 219 | // Experiment with timing to get the appearence to look the way you want 220 | drawAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 221 | 222 | // Add the animation to the circle 223 | [self.backgroundLayer addAnimation:drawAnimation forKey:@"drawCircleAnimation"]; 224 | } 225 | 226 | - (CGFloat)calculateToValueWithPercent:(CGFloat)percent { 227 | return (kStartAngle + (percent * 2 * M_PI) / 100); 228 | } 229 | 230 | - (NSArray *)calculateColorsWithPercent:(CGFloat)percent { 231 | NSMutableArray *colorsArray = [NSMutableArray new]; 232 | if (percent <= 30) { 233 | [colorsArray addObject:(id)[UIColor greenColor].CGColor]; 234 | } 235 | 236 | if (percent > 30 && percent <= 80 ) { 237 | [colorsArray addObject:(id)[UIColor greenColor].CGColor]; 238 | [colorsArray addObject:(id)[UIColor yellowColor].CGColor]; 239 | } 240 | 241 | if (percent > 80) { 242 | [colorsArray addObject:(id)[UIColor greenColor].CGColor]; 243 | [colorsArray addObject:(id)[UIColor yellowColor].CGColor]; 244 | [colorsArray addObject:(id)[UIColor orangeColor].CGColor]; 245 | [colorsArray addObject:(id)[UIColor redColor].CGColor]; 246 | } 247 | 248 | return colorsArray; 249 | } 250 | 251 | @end 252 | 253 | 254 | -------------------------------------------------------------------------------- /DrawCircleAnimation/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /DrawCircleAnimation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D69D11181C0C099B00F02E75 /* KNCirclePercentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D69D11151C0C099B00F02E75 /* KNCirclePercentView.m */; }; 11 | D69D11191C0C099B00F02E75 /* KNPercentLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = D69D11171C0C099B00F02E75 /* KNPercentLabel.m */; }; 12 | D6B7A0F31C02FCAD0033A9E2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D6B7A0F21C02FCAD0033A9E2 /* main.m */; }; 13 | D6B7A0F61C02FCAD0033A9E2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D6B7A0F51C02FCAD0033A9E2 /* AppDelegate.m */; }; 14 | D6B7A0F91C02FCAD0033A9E2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D6B7A0F81C02FCAD0033A9E2 /* ViewController.m */; }; 15 | D6B7A0FC1C02FCAD0033A9E2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6B7A0FA1C02FCAD0033A9E2 /* Main.storyboard */; }; 16 | D6B7A0FE1C02FCAD0033A9E2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D6B7A0FD1C02FCAD0033A9E2 /* Assets.xcassets */; }; 17 | D6B7A1011C02FCAD0033A9E2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6B7A0FF1C02FCAD0033A9E2 /* LaunchScreen.storyboard */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | D69D11141C0C099B00F02E75 /* KNCirclePercentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KNCirclePercentView.h; path = KNCirclePercentView/KNCirclePercentView.h; sourceTree = ""; }; 22 | D69D11151C0C099B00F02E75 /* KNCirclePercentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KNCirclePercentView.m; path = KNCirclePercentView/KNCirclePercentView.m; sourceTree = ""; }; 23 | D69D11161C0C099B00F02E75 /* KNPercentLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KNPercentLabel.h; path = KNCirclePercentView/KNPercentLabel.h; sourceTree = ""; }; 24 | D69D11171C0C099B00F02E75 /* KNPercentLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KNPercentLabel.m; path = KNCirclePercentView/KNPercentLabel.m; sourceTree = ""; }; 25 | D6B7A0EE1C02FCAD0033A9E2 /* DrawCircleAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DrawCircleAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | D6B7A0F21C02FCAD0033A9E2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 27 | D6B7A0F41C02FCAD0033A9E2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 28 | D6B7A0F51C02FCAD0033A9E2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 29 | D6B7A0F71C02FCAD0033A9E2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 30 | D6B7A0F81C02FCAD0033A9E2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 31 | D6B7A0FB1C02FCAD0033A9E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 32 | D6B7A0FD1C02FCAD0033A9E2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 33 | D6B7A1001C02FCAD0033A9E2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 34 | D6B7A1021C02FCAD0033A9E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | D6B7A0EB1C02FCAD0033A9E2 /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | D6B7A0E51C02FCAD0033A9E2 = { 49 | isa = PBXGroup; 50 | children = ( 51 | D6B7A0F01C02FCAD0033A9E2 /* DrawCircleAnimation */, 52 | D6B7A0EF1C02FCAD0033A9E2 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | D6B7A0EF1C02FCAD0033A9E2 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | D6B7A0EE1C02FCAD0033A9E2 /* DrawCircleAnimation.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | D6B7A0F01C02FCAD0033A9E2 /* DrawCircleAnimation */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | D6C8748A1C044220002633CF /* CirclePercentView */, 68 | D6B7A0F41C02FCAD0033A9E2 /* AppDelegate.h */, 69 | D6B7A0F51C02FCAD0033A9E2 /* AppDelegate.m */, 70 | D6B7A0F71C02FCAD0033A9E2 /* ViewController.h */, 71 | D6B7A0F81C02FCAD0033A9E2 /* ViewController.m */, 72 | D6B7A0FA1C02FCAD0033A9E2 /* Main.storyboard */, 73 | D6B7A0FD1C02FCAD0033A9E2 /* Assets.xcassets */, 74 | D6B7A0FF1C02FCAD0033A9E2 /* LaunchScreen.storyboard */, 75 | D6B7A1021C02FCAD0033A9E2 /* Info.plist */, 76 | D6B7A0F11C02FCAD0033A9E2 /* Supporting Files */, 77 | ); 78 | path = DrawCircleAnimation; 79 | sourceTree = ""; 80 | }; 81 | D6B7A0F11C02FCAD0033A9E2 /* Supporting Files */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | D6B7A0F21C02FCAD0033A9E2 /* main.m */, 85 | ); 86 | name = "Supporting Files"; 87 | sourceTree = ""; 88 | }; 89 | D6C8748A1C044220002633CF /* CirclePercentView */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | D69D11141C0C099B00F02E75 /* KNCirclePercentView.h */, 93 | D69D11151C0C099B00F02E75 /* KNCirclePercentView.m */, 94 | D69D11161C0C099B00F02E75 /* KNPercentLabel.h */, 95 | D69D11171C0C099B00F02E75 /* KNPercentLabel.m */, 96 | ); 97 | name = CirclePercentView; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | D6B7A0ED1C02FCAD0033A9E2 /* DrawCircleAnimation */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = D6B7A1051C02FCAD0033A9E2 /* Build configuration list for PBXNativeTarget "DrawCircleAnimation" */; 106 | buildPhases = ( 107 | D6B7A0EA1C02FCAD0033A9E2 /* Sources */, 108 | D6B7A0EB1C02FCAD0033A9E2 /* Frameworks */, 109 | D6B7A0EC1C02FCAD0033A9E2 /* Resources */, 110 | ); 111 | buildRules = ( 112 | ); 113 | dependencies = ( 114 | ); 115 | name = DrawCircleAnimation; 116 | productName = DrawCircleAnimation; 117 | productReference = D6B7A0EE1C02FCAD0033A9E2 /* DrawCircleAnimation.app */; 118 | productType = "com.apple.product-type.application"; 119 | }; 120 | /* End PBXNativeTarget section */ 121 | 122 | /* Begin PBXProject section */ 123 | D6B7A0E61C02FCAD0033A9E2 /* Project object */ = { 124 | isa = PBXProject; 125 | attributes = { 126 | LastUpgradeCheck = 0710; 127 | ORGANIZATIONNAME = "Khoi Nguyen Nguyen"; 128 | TargetAttributes = { 129 | D6B7A0ED1C02FCAD0033A9E2 = { 130 | CreatedOnToolsVersion = 7.1.1; 131 | }; 132 | }; 133 | }; 134 | buildConfigurationList = D6B7A0E91C02FCAD0033A9E2 /* Build configuration list for PBXProject "DrawCircleAnimation" */; 135 | compatibilityVersion = "Xcode 3.2"; 136 | developmentRegion = English; 137 | hasScannedForEncodings = 0; 138 | knownRegions = ( 139 | en, 140 | Base, 141 | ); 142 | mainGroup = D6B7A0E51C02FCAD0033A9E2; 143 | productRefGroup = D6B7A0EF1C02FCAD0033A9E2 /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | D6B7A0ED1C02FCAD0033A9E2 /* DrawCircleAnimation */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | D6B7A0EC1C02FCAD0033A9E2 /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | D6B7A1011C02FCAD0033A9E2 /* LaunchScreen.storyboard in Resources */, 158 | D6B7A0FE1C02FCAD0033A9E2 /* Assets.xcassets in Resources */, 159 | D6B7A0FC1C02FCAD0033A9E2 /* Main.storyboard in Resources */, 160 | ); 161 | runOnlyForDeploymentPostprocessing = 0; 162 | }; 163 | /* End PBXResourcesBuildPhase section */ 164 | 165 | /* Begin PBXSourcesBuildPhase section */ 166 | D6B7A0EA1C02FCAD0033A9E2 /* Sources */ = { 167 | isa = PBXSourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | D6B7A0F91C02FCAD0033A9E2 /* ViewController.m in Sources */, 171 | D69D11191C0C099B00F02E75 /* KNPercentLabel.m in Sources */, 172 | D6B7A0F61C02FCAD0033A9E2 /* AppDelegate.m in Sources */, 173 | D6B7A0F31C02FCAD0033A9E2 /* main.m in Sources */, 174 | D69D11181C0C099B00F02E75 /* KNCirclePercentView.m in Sources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXSourcesBuildPhase section */ 179 | 180 | /* Begin PBXVariantGroup section */ 181 | D6B7A0FA1C02FCAD0033A9E2 /* Main.storyboard */ = { 182 | isa = PBXVariantGroup; 183 | children = ( 184 | D6B7A0FB1C02FCAD0033A9E2 /* Base */, 185 | ); 186 | name = Main.storyboard; 187 | sourceTree = ""; 188 | }; 189 | D6B7A0FF1C02FCAD0033A9E2 /* LaunchScreen.storyboard */ = { 190 | isa = PBXVariantGroup; 191 | children = ( 192 | D6B7A1001C02FCAD0033A9E2 /* Base */, 193 | ); 194 | name = LaunchScreen.storyboard; 195 | sourceTree = ""; 196 | }; 197 | /* End PBXVariantGroup section */ 198 | 199 | /* Begin XCBuildConfiguration section */ 200 | D6B7A1031C02FCAD0033A9E2 /* Debug */ = { 201 | isa = XCBuildConfiguration; 202 | buildSettings = { 203 | ALWAYS_SEARCH_USER_PATHS = NO; 204 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 205 | CLANG_CXX_LIBRARY = "libc++"; 206 | CLANG_ENABLE_MODULES = YES; 207 | CLANG_ENABLE_OBJC_ARC = YES; 208 | CLANG_WARN_BOOL_CONVERSION = YES; 209 | CLANG_WARN_CONSTANT_CONVERSION = YES; 210 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 211 | CLANG_WARN_EMPTY_BODY = YES; 212 | CLANG_WARN_ENUM_CONVERSION = YES; 213 | CLANG_WARN_INT_CONVERSION = YES; 214 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 215 | CLANG_WARN_UNREACHABLE_CODE = YES; 216 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 217 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 218 | COPY_PHASE_STRIP = NO; 219 | DEBUG_INFORMATION_FORMAT = dwarf; 220 | ENABLE_STRICT_OBJC_MSGSEND = YES; 221 | ENABLE_TESTABILITY = YES; 222 | GCC_C_LANGUAGE_STANDARD = gnu99; 223 | GCC_DYNAMIC_NO_PIC = NO; 224 | GCC_NO_COMMON_BLOCKS = YES; 225 | GCC_OPTIMIZATION_LEVEL = 0; 226 | GCC_PREPROCESSOR_DEFINITIONS = ( 227 | "DEBUG=1", 228 | "$(inherited)", 229 | ); 230 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 231 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 232 | GCC_WARN_UNDECLARED_SELECTOR = YES; 233 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 234 | GCC_WARN_UNUSED_FUNCTION = YES; 235 | GCC_WARN_UNUSED_VARIABLE = YES; 236 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 237 | MTL_ENABLE_DEBUG_INFO = YES; 238 | ONLY_ACTIVE_ARCH = YES; 239 | SDKROOT = iphoneos; 240 | }; 241 | name = Debug; 242 | }; 243 | D6B7A1041C02FCAD0033A9E2 /* Release */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BOOL_CONVERSION = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 258 | CLANG_WARN_UNREACHABLE_CODE = YES; 259 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 260 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 261 | COPY_PHASE_STRIP = NO; 262 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 263 | ENABLE_NS_ASSERTIONS = NO; 264 | ENABLE_STRICT_OBJC_MSGSEND = YES; 265 | GCC_C_LANGUAGE_STANDARD = gnu99; 266 | GCC_NO_COMMON_BLOCKS = YES; 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 9.1; 274 | MTL_ENABLE_DEBUG_INFO = NO; 275 | SDKROOT = iphoneos; 276 | VALIDATE_PRODUCT = YES; 277 | }; 278 | name = Release; 279 | }; 280 | D6B7A1061C02FCAD0033A9E2 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 284 | INFOPLIST_FILE = DrawCircleAnimation/Info.plist; 285 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 286 | PRODUCT_BUNDLE_IDENTIFIER = com.asiantech.dev.DrawCircleAnimation; 287 | PRODUCT_NAME = "$(TARGET_NAME)"; 288 | }; 289 | name = Debug; 290 | }; 291 | D6B7A1071C02FCAD0033A9E2 /* Release */ = { 292 | isa = XCBuildConfiguration; 293 | buildSettings = { 294 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 295 | INFOPLIST_FILE = DrawCircleAnimation/Info.plist; 296 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 297 | PRODUCT_BUNDLE_IDENTIFIER = com.asiantech.dev.DrawCircleAnimation; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | }; 300 | name = Release; 301 | }; 302 | /* End XCBuildConfiguration section */ 303 | 304 | /* Begin XCConfigurationList section */ 305 | D6B7A0E91C02FCAD0033A9E2 /* Build configuration list for PBXProject "DrawCircleAnimation" */ = { 306 | isa = XCConfigurationList; 307 | buildConfigurations = ( 308 | D6B7A1031C02FCAD0033A9E2 /* Debug */, 309 | D6B7A1041C02FCAD0033A9E2 /* Release */, 310 | ); 311 | defaultConfigurationIsVisible = 0; 312 | defaultConfigurationName = Release; 313 | }; 314 | D6B7A1051C02FCAD0033A9E2 /* Build configuration list for PBXNativeTarget "DrawCircleAnimation" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | D6B7A1061C02FCAD0033A9E2 /* Debug */, 318 | D6B7A1071C02FCAD0033A9E2 /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | /* End XCConfigurationList section */ 324 | }; 325 | rootObject = D6B7A0E61C02FCAD0033A9E2 /* Project object */; 326 | } 327 | --------------------------------------------------------------------------------