I created a CALayer and a button, when I click on the button the CALayer corner radius is changed, then when I click on the button again the corner radius is back to its original radius. What I want is to do the same thing with the CALayer's size
here is the code I use:
layer.cornerRadius = (layer.cornerRadius==0.0f) ? 37.0f : 0.0f;
Any help please?
Thanks in Advance
Declare property
@property (assign, nonatomic) CGRect originalSize;
and add code below:
if (CGRectEqualToRect(_originalSize, CGRectZero)){
_originalSize = [layer bounds];//store original bounds in first time
}
[layer setBounds:CGRectEqualToRect(_originalSize, layer.bounds) ? CGRectMake(0, 0, 100, 100) : _originalSize];