change fillColor of selected CAShapeLayer
Posted
by
Frank
on Stack Overflow
See other posts from Stack Overflow
or by Frank
Published on 2011-11-23T17:35:33Z
Indexed on
2011/11/23
17:50 UTC
Read the original article
Hit count: 391
I'm trying to change the fillColor of a CAShapeLayer when the layer it's contained in is touched. I'm able to change the background color of the tapped layer like this:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CALayer *layer = [(CALayer *)self.view.layer.presentationLayer hitTest:point];
layer = layer.modelLayer;
layer.backgroundColor = [UIColor blueColor].CGColor;
}
This turns the background of "layer" blue as expected. My problem is how do I change the color of the CAShapelayer inside "layer"? Thanks!
© Stack Overflow or respective owner