Permalink
Browse files

Polished

  • Loading branch information...
1 parent fc2281e commit fcceea2037411a9ee34aa60f4aaeade0b6b874cf @eelco committed Sep 19, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 TrafficLight/LightsLayer.m
@@ -24,6 +24,9 @@ @implementation LightsLayer
- (CALayer*)lightLayer {
CALayer* layer = [CALayer layer];
layer.backgroundColor = [[UIColor darkGrayColor] CGColor];
+ layer.contents = (id)[UIImage imageNamed:@"lens.png"].CGImage;
+ layer.shadowColor = [[UIColor yellowColor] CGColor];
+ layer.shadowOffset = CGSizeZero;
return layer;
}
@@ -51,10 +54,12 @@ - (void)turnOn:(CALayer*)lightLayer {
color = [UIColor greenColor];
}
+ lightLayer.shadowOpacity = 0.8;
lightLayer.backgroundColor = [color CGColor];
}
- (void)turnOff:(CALayer*)lightLayer {
+ lightLayer.shadowOpacity = 0;
lightLayer.backgroundColor = [[UIColor darkGrayColor] CGColor];
}
@@ -140,6 +145,10 @@ - (void)layoutSublayers {
self.orangeLight.cornerRadius = lightHeightWidth / 2;
self.greenLight.cornerRadius = lightHeightWidth / 2;
+ self.redLight.shadowRadius = lightHeightWidth / 5;
+ self.orangeLight.shadowRadius = lightHeightWidth / 5;
+ self.greenLight.shadowRadius = lightHeightWidth / 5;
+
self.redLight.frame = CGRectMake(lightInsetX, lightInsetY,
lightHeightWidth, lightHeightWidth);
self.orangeLight.frame = CGRectMake(lightInsetX, lightMaxHeight + lightMargin + lightInsetY,

0 comments on commit fcceea2

Please sign in to comment.