From b26fc958230cf9f7d8a838a0dd9eed28e311e8a8 Mon Sep 17 00:00:00 2001 From: Luiz Duraes Date: Mon, 24 Feb 2014 16:14:56 -0300 Subject: [PATCH] Suppressed warning on iOS 7 regarding using a deprecated nsstring method... --- Pie Chart Library/DLPieChart.h | 15 ++- Pie Chart Library/DLPieChart.m | 98 +++++++++++++----- .../xcshareddata/PieChart.xccheckout | 41 ++++++++ .../UserInterfaceState.xcuserstate | Bin 0 -> 12372 bytes .../xcschemes/PieChart.xcscheme | 96 +++++++++++++++++ .../xcschemes/xcschememanagement.plist | 27 +++++ PieChart/PieChart-Prefix.pch | 2 + PieChart/ViewController.m | 28 ++--- 8 files changed, 257 insertions(+), 50 deletions(-) create mode 100644 PieChart.xcodeproj/project.xcworkspace/xcshareddata/PieChart.xccheckout create mode 100644 PieChart.xcodeproj/project.xcworkspace/xcuserdata/lduraes.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/PieChart.xcscheme create mode 100644 PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/Pie Chart Library/DLPieChart.h b/Pie Chart Library/DLPieChart.h index ac1e0ea..825c8bf 100755 --- a/Pie Chart Library/DLPieChart.h +++ b/Pie Chart Library/DLPieChart.h @@ -9,21 +9,27 @@ #import @class DLPieChart; + @protocol DLPieChartDataSource + @required - (NSUInteger)numberOfSlicesInPieChart:(DLPieChart *)pieChart; - (CGFloat)pieChart:(DLPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index; + @optional - (UIColor *)pieChart:(DLPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index; - (NSString *)pieChart:(DLPieChart *)pieChart textForSliceAtIndex:(NSUInteger)index; + @end @protocol DLPieChartDelegate + @optional - (void)pieChart:(DLPieChart *)pieChart willSelectSliceAtIndex:(NSUInteger)index; - (void)pieChart:(DLPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index; - (void)pieChart:(DLPieChart *)pieChart willDeselectSliceAtIndex:(NSUInteger)index; - (void)pieChart:(DLPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index; + @end @interface DLPieChart : UIView @@ -42,10 +48,13 @@ @property(nonatomic, assign) CGFloat selectedSliceStroke; @property(nonatomic, assign) CGFloat selectedSliceOffsetRadius; @property(nonatomic, assign) BOOL showPercentage; +@property (nonatomic ,retain) NSMutableArray *DLDataArray; +@property (nonatomic, retain) NSMutableArray *DLColorsArray; +@property (nonatomic, retain) DLPieChart *DLPieChartView; + - (id)initWithFrame:(CGRect)frame Center:(CGPoint)center Radius:(CGFloat)radius; - (void)reloadData; - (void)setPieBackgroundColor:(UIColor *)color; - - (void)setSliceSelectedAtIndex:(NSInteger)index; - (void)setSliceDeselectedAtIndex:(NSInteger)index; @@ -59,8 +68,4 @@ -(void)drawLegends:(DLPieChart *)layerHostingView dataArray:(NSMutableArray*)dataArray; -@property (nonatomic ,retain) NSMutableArray *DLDataArray; -@property (nonatomic, retain) NSMutableArray *DLColorsArray; -@property (nonatomic, retain) DLPieChart *DLPieChartView; - @end; diff --git a/Pie Chart Library/DLPieChart.m b/Pie Chart Library/DLPieChart.m index 4d6e6ff..5c4295a 100755 --- a/Pie Chart Library/DLPieChart.m +++ b/Pie Chart Library/DLPieChart.m @@ -12,36 +12,41 @@ #define OFFSET 20 @interface SliceLayer : CAShapeLayer + @property (nonatomic, assign) CGFloat value; @property (nonatomic, assign) CGFloat percentage; @property (nonatomic, assign) double startAngle; @property (nonatomic, assign) double endAngle; @property (nonatomic, assign) BOOL isSelected; @property (nonatomic, strong) NSString *text; + - (void)createArcAnimationForKey:(NSString *)key fromValue:(NSNumber *)from toValue:(NSNumber *)to Delegate:(id)delegate; + @end @implementation SliceLayer -@synthesize text = _text; -@synthesize value = _value; -@synthesize percentage = _percentage; -@synthesize startAngle = _startAngle; -@synthesize endAngle = _endAngle; -@synthesize isSelected = _isSelected; + +//@synthesize text = _text; +//@synthesize value = _value; +//@synthesize percentage = _percentage; +//@synthesize startAngle = _startAngle; +//@synthesize endAngle = _endAngle; +//@synthesize isSelected = _isSelected; - (NSString*)description { return [NSString stringWithFormat:@"value:%f, percentage:%0.0f, start:%f, end:%f", _value, _percentage, _startAngle/M_PI*180, _endAngle/M_PI*180]; } + + (BOOL)needsDisplayForKey:(NSString *)key { if ([key isEqualToString:@"startAngle"] || [key isEqualToString:@"endAngle"]) { return YES; } - else { - return [super needsDisplayForKey:key]; - } + + return [super needsDisplayForKey:key]; } + - (id)initWithLayer:(id)layer { if (self = [super initWithLayer:layer]) @@ -53,6 +58,7 @@ - (id)initWithLayer:(id)layer } return self; } + - (void)createArcAnimationForKey:(NSString *)key fromValue:(NSNumber *)from toValue:(NSNumber *)to Delegate:(id)delegate { CABasicAnimation *arcAnimation = [CABasicAnimation animationWithKeyPath:key]; @@ -65,14 +71,17 @@ - (void)createArcAnimationForKey:(NSString *)key fromValue:(NSNumber *)from toVa [self addAnimation:arcAnimation forKey:key]; [self setValue:to forKey:key]; } + @end @interface DLPieChart (Private) + - (void)updateTimerFired:(NSTimer *)timer; - (SliceLayer *)createSliceLayer; - (CGSize)sizeThatFitsString:(NSString *)string; - (void)updateLabelForLayer:(SliceLayer *)pieLayer value:(CGFloat)value; - (void)notifyDelegateOfSelectionChangeFrom:(NSUInteger)previousSelection to:(NSUInteger)newSelection; + @end @implementation DLPieChart @@ -88,21 +97,20 @@ @implementation DLPieChart static NSUInteger kDefaultSliceZOrder = 100; -@synthesize dataSource = _dataSource; -@synthesize delegate = _delegate; -@synthesize startPieAngle = _startPieAngle; -@synthesize animationSpeed = _animationSpeed; -@synthesize pieCenter = _pieCenter; -@synthesize pieRadius = _pieRadius; -@synthesize showLabel = _showLabel; -@synthesize labelFont = _labelFont; -@synthesize labelColor = _labelColor; -@synthesize labelShadowColor = _labelShadowColor; -@synthesize labelRadius = _labelRadius; -@synthesize selectedSliceStroke = _selectedSliceStroke; -@synthesize selectedSliceOffsetRadius = _selectedSliceOffsetRadius; -@synthesize showPercentage = _showPercentage; - +//@synthesize dataSource = _dataSource; +//@synthesize delegate = _delegate; +//@synthesize startPieAngle = _startPieAngle; +//@synthesize animationSpeed = _animationSpeed; +//@synthesize pieCenter = _pieCenter; +//@synthesize pieRadius = _pieRadius; +//@synthesize showLabel = _showLabel; +//@synthesize labelFont = _labelFont; +//@synthesize labelColor = _labelColor; +//@synthesize labelShadowColor = _labelShadowColor; +//@synthesize labelRadius = _labelRadius; +//@synthesize selectedSliceStroke = _selectedSliceStroke; +//@synthesize selectedSliceOffsetRadius = _selectedSliceOffsetRadius; +//@synthesize showPercentage = _showPercentage; @synthesize DLDataArray, DLColorsArray,DLPieChartView; static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle) @@ -223,7 +231,19 @@ - (void)setShowPercentage:(BOOL)showPercentage label = [NSString stringWithFormat:@"%0.0f", layer.percentage*100]; else label = (layer.text)?layer.text:[NSString stringWithFormat:@"%0.0f", layer.value]; - CGSize size = [label sizeWithFont:self.labelFont]; + + //CGSize size = [label sizeWithFont:self.labelFont]; + CGSize size; + + if(getIOSVersion() >= 7) { + size = [label sizeWithAttributes:@{NSFontAttributeName:self.labelFont}]; + } + else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + size = [label sizeWithFont:self.labelFont]; +#pragma clang diagnostic pop + } if(M_PI*2*_labelRadius*layer.percentage < MAX(size.width,size.height)) { @@ -636,7 +656,20 @@ - (SliceLayer *)createSliceLayer [textLayer setShadowOpacity:1.0f]; [textLayer setShadowRadius:2.0f]; } - CGSize size = [@"0" sizeWithFont:self.labelFont]; + + //CGSize size = [@"0" sizeWithFont:self.labelFont]; + CGSize size; + + if(getIOSVersion() >= 7) { + size = [@"0" sizeWithAttributes:@{NSFontAttributeName:self.labelFont}]; + } + else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + size = [@"0" sizeWithFont:self.labelFont]; +#pragma clang diagnostic pop + } + [CATransaction setDisableActions:YES]; [textLayer setFrame:CGRectMake(0, 0, size.width, size.height)]; [textLayer setPosition:CGPointMake(_pieCenter.x + (_labelRadius * cos(0)), _pieCenter.y + (_labelRadius * sin(0)))]; @@ -656,7 +689,18 @@ - (void)updateLabelForLayer:(SliceLayer *)pieLayer value:(CGFloat)value else label = (pieLayer.text)?pieLayer.text:[NSString stringWithFormat:@"%0.0f", value]; - CGSize size = [label sizeWithFont:self.labelFont]; + //CGSize size = [label sizeWithFont:self.labelFont]; + CGSize size; + + if(getIOSVersion() >= 7) { + size = [label sizeWithAttributes:@{NSFontAttributeName:self.labelFont}]; + } + else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + size = [label sizeWithFont:self.labelFont]; +#pragma clang diagnostic pop + } [CATransaction setDisableActions:YES]; if(M_PI*2*_labelRadius*pieLayer.percentage < MAX(size.width,size.height) || value <= 0) diff --git a/PieChart.xcodeproj/project.xcworkspace/xcshareddata/PieChart.xccheckout b/PieChart.xcodeproj/project.xcworkspace/xcshareddata/PieChart.xccheckout new file mode 100644 index 0000000..4d53026 --- /dev/null +++ b/PieChart.xcodeproj/project.xcworkspace/xcshareddata/PieChart.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + BB8715F0-94F3-463B-9A21-DA59281C7A3E + IDESourceControlProjectName + PieChart + IDESourceControlProjectOriginsDictionary + + EABBA475-0CD2-4703-8D75-571C423FC6E9 + ssh://github.com/lduraes/piechart.git + + IDESourceControlProjectPath + PieChart.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + EABBA475-0CD2-4703-8D75-571C423FC6E9 + ../.. + + IDESourceControlProjectURL + ssh://github.com/lduraes/piechart.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + EABBA475-0CD2-4703-8D75-571C423FC6E9 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + EABBA475-0CD2-4703-8D75-571C423FC6E9 + IDESourceControlWCCName + piechart + + + + diff --git a/PieChart.xcodeproj/project.xcworkspace/xcuserdata/lduraes.xcuserdatad/UserInterfaceState.xcuserstate b/PieChart.xcodeproj/project.xcworkspace/xcuserdata/lduraes.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..fdf889a44d4b9300ac9706464bc32f5a74ba3155 GIT binary patch literal 12372 zcmcgyd3;mF_Mauq-ZW{}rX{&;ASp}fLQ4yRKwA(H$`bairtPJTv`tM?5D=Y+4_5?4 zQ52E3>>?nt%8sCj$SNp{h$t#<;J(Z6+}x&ZkoTT{Jb&${P41nUbIzPO^F7NvXsSk|8UXam}e zwxJzpH`<3zpp)nwbPAnD@1pn61@r;Bj6Olv&^PE?^d0&Q{f-HiVi}IbdYpjmn8Qxo z0cYbJ+#TPF`{3JfU)&ED<2$eim*7%dhIu>@m*WatjeWQlPsR*~@cnoueh@Fj&*JCs zBK$mFj9F~Fl0s5R8p$D@$*rUZDIonw5g9>7l2POi z;vpsEP7);32qQDeEb=gUggj2>lc&jZ3({EzE0nu2kD#i5PgT9qNnM*^h0`yendZ|U(ny^@AMD)C%rB~5{X16kxLYk z*x{|KYbz^HA_Y<+6;h)(6hE@a-Ek5>H82J~8?ACg>(WY3AW)BDk%kdQ>yZ}en1t*%?^{xdl1B(>mwp<)>wL>XM(9pOf1sEw@v4PF7w{W_Er-VX@ZGudw$>pMO%I z##71{`bul7`08MUu?g8x>Plor7L;O;n3TzwoGF-+shD~t;!rY5K@O0^ zjGV~HV%a|S8p{EhVweSfoyFQ)Tk;v^DJk$(2mQXvO5R^wkeS`9b8c>ST3%MC?6mB{ z{EW2x!t8>yyw14=z4Hq4v$G01PY{NCtIK>-`uIIne6cneUJUY=@qWInN&G0Xfnse! z)1ZFUeL$aqQa{gE5A>D6_zo@Q5h*u|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IyV)~0Mq*_yIF zWmn3clq(Liqrfr1QREor@Hi?QlN{BKyBv2rraSI+gd8&+k2&Tzo^dR5tZ}S!Y;bIH z>~QRM>~kD&yx}XOVNHlXq4+15W0g?VRhJ?_A(q=v?G{!MVn{&iS%) zqjQUMn{&H!r}L6a=E`)9b(OiQT(z!yT_M*au6eEnu4S$juJx{0T$@~5TzgzcUB_J~ lU8h{{y3V-Hx!!ku;QGe(qw9Ausv$)Dlq5#Qfynje{{iQcrqKWZ literal 0 HcmV?d00001 diff --git a/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/PieChart.xcscheme b/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/PieChart.xcscheme new file mode 100644 index 0000000..aa4fcaa --- /dev/null +++ b/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/PieChart.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/xcschememanagement.plist b/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7c4571 --- /dev/null +++ b/PieChart.xcodeproj/xcuserdata/lduraes.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + PieChart.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 9C82E1221886CB4A00EACB7D + + primary + + + 9C82E1431886CB4A00EACB7D + + primary + + + + + diff --git a/PieChart/PieChart-Prefix.pch b/PieChart/PieChart-Prefix.pch index 82a2bb4..dc27559 100644 --- a/PieChart/PieChart-Prefix.pch +++ b/PieChart/PieChart-Prefix.pch @@ -14,3 +14,5 @@ #import #import #endif + +#define getIOSVersion() [[UIDevice currentDevice].systemVersion floatValue] diff --git a/PieChart/ViewController.m b/PieChart/ViewController.m index 97483ea..19c6031 100644 --- a/PieChart/ViewController.m +++ b/PieChart/ViewController.m @@ -8,18 +8,25 @@ #import "ViewController.h" - @interface ViewController () @end @implementation ViewController +#pragma mark - DLPieChartDelegate methods + +-(void)pieChart:(DLPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index { + int value = [[self.pieChart.DLDataArray objectAtIndex:index] integerValue]; + + NSLog(@"Changed value >> %i",value); +} + +#pragma mark - Lifecycle methods + - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - NSMutableArray * arrayChart = [NSMutableArray new]; NSMutableArray * arrayColors = [NSMutableArray new]; @@ -44,21 +51,6 @@ - (void)viewDidLoad self.pieChart.layer.borderWidth = 2; self.pieChart.layer.cornerRadius = 10; self.pieChart.delegate = self; - -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (void)pieChart:(DLPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index { - int value = [[self.pieChart.DLDataArray objectAtIndex:index] integerValue]; - - NSLog(@"Tocou valor %i", value); - - } @end