Permalink
Browse files

Do not synthesize CALayer properties

The CALayer class has automatic properties so we can just use @dynamic instead of @synthesize
See Rob Napier (@cocoaphony) Animating Custom Layer Properties talk at http://cocoaheads.tv/animating-custom-layer-properties-by-rob-napier/
  • Loading branch information...
0xced committed Oct 22, 2012
1 parent 8eb2deb commit 92c2ec951884d112d91e0e420d03ebfe416a403b
Showing with 5 additions and 19 deletions.
  1. +5 −19 DACircularProgress/DACircularProgressView.m
@@ -22,31 +22,17 @@ @interface DACircularProgressLayer : CALayer
@implementation DACircularProgressLayer
-@synthesize trackTintColor = _trackTintColor;
-@synthesize progressTintColor = _progressTintColor;
-@synthesize roundedCorners = _roundedCorners;
-@synthesize thicknessRatio = _thicknessRatio;
-@synthesize progress = _progress;
+@dynamic trackTintColor;
+@dynamic progressTintColor;
+@dynamic roundedCorners;
+@dynamic thicknessRatio;
+@dynamic progress;
+ (BOOL)needsDisplayForKey:(NSString *)key
{
return [key isEqualToString:@"progress"] ? YES : [super needsDisplayForKey:key];
}
-- (id)initWithLayer:(DACircularProgressLayer *)layer
-{
- self = [super initWithLayer:layer];
- if (self)
- {
- self.trackTintColor = layer.trackTintColor;
- self.progressTintColor = layer.progressTintColor;
- self.roundedCorners = layer.roundedCorners;
- self.thicknessRatio = layer.thicknessRatio;
- self.progress = layer.progress;
- }
- return self;
-}
-
- (void)drawInContext:(CGContextRef)context
{
CGRect rect = self.bounds;

0 comments on commit 92c2ec9

Please sign in to comment.