Skip to content
This repository has been archived by the owner on Mar 3, 2018. It is now read-only.

Commit

Permalink
Fix XYPieChart deprication erors
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Nov 22, 2013
1 parent 0b2fdc2 commit a5cb961
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ExtraCredits/XYPieChart.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ - (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 = [label sizeWithAttributes:@{NSFontAttributeName:self.labelFont}];

if(M_PI*2*_labelRadius*layer.percentage < MAX(size.width,size.height))
{
Expand Down Expand Up @@ -640,7 +641,7 @@ - (SliceLayer *)createSliceLayer
[textLayer setShadowOpacity:1.0f];
[textLayer setShadowRadius:2.0f];
}
CGSize size = [@"0" sizeWithFont:self.labelFont];
CGSize size = [@"" sizeWithAttributes:@{NSFontAttributeName:self.labelFont}];
[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)))];
Expand All @@ -660,7 +661,7 @@ - (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 sizeWithAttributes:@{NSFontAttributeName:self.labelFont}];

[CATransaction setDisableActions:YES];
if(M_PI*2*_labelRadius*pieLayer.percentage < MAX(size.width,size.height) || value <= 0)
Expand Down

2 comments on commit a5cb961

@evanpurkhiser
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually test this. So it would probably be good for someone to test this =P

@mwatz122
Copy link
Collaborator

@mwatz122 mwatz122 commented on a5cb961 Nov 22, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.