iOS add / remove shadow from a view

Sorry, not sure the correct way, but have you tried changing the properties of the layer shadow? For example, one of these;

 layer.shadowOffset = CGSizeMake(0, 0);
 layer.shadowColor = [[UIColor clearColor] CGColor];
 layer.cornerRadius = 0.0f;
 layer.shadowRadius = 0.0f;
 layer.shadowOpacity = 0.00f;

I guess you could use the shadowOpacity property of your CALayer.

So this should work:

self.layer.shadowOpacity = 0;

See the CALayer's shadowOpacity documentation page

And to show your shadow use:

self.layer.shadowOpacity = 1.0;

Tags:

Ios

Uiview