我CAGradientLayer为我的自定义创建了一个UIButton.创建它的代码如下:
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];
Run Code Online (Sandbox Code Playgroud)
我的问题是:按下按钮我需要将按钮的渐变视图改变180度,我该怎么做?