Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Polished

  • Loading branch information...
commit fcceea2037411a9ee34aa60f4aaeade0b6b874cf 1 parent fc2281e
Eelco Lempsink authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 TrafficLight/LightsLayer.m
9 TrafficLight/LightsLayer.m
View
@@ -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,
Please sign in to comment.
Something went wrong with that request. Please try again.