I have created a CAGradientLayer for my custom UIButtons. The code for creating it is as follows:
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = btn.bounds;
gradient.cornerRadius = 10.0f;
locations=[[NSArray alloc] initWithObjects: LOC_0, LOC_5, LOC_51,LOC_1, nil];
[gradient setLocations:locations];
colorNext=[[NSArray alloc] initWithObjects:(id) G3_rgb1, (id) G3_rgb2, (id) G3_rgb3, (id) G3_rgb4, nil];
gradient.colors = colorNext;
[btn.layer insertSublayer:gradient atIndex:0];
My question is: on the press of the button I need to change the gradient view of the button by 180 degrees, how should I do this?