我爲我的自定義UIButton
創建了CAGradientLayer
。創建它的代碼如下:如何將CAGradientLayer旋轉180度?
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];
我的問題是:在按鈕上,我需要180度改變按鈕的梯度視圖的新聞,我應該怎麼辦呢?