uiview
*theview = [[
uiview
alloc
] initwithframe
:self
.headerbackimgview
.frame];
[self
.headerview
addsubview
:theview];
//初始化
cagradientlayer
物件,使它的大小為
uiview
的大小
cagradientlayer
*gradientlayer = [
cagradientlayer
layer];
gradientlayer.
frame
= theview.
bounds;
//將cagradientlayer
物件新增在我們要設定背景色的檢視的
layer層
[theview.
layer
addsublayer
:gradientlayer];
//設定漸變區域的起始和終止位置(範圍為
0-1)
gradientlayer.
startpoint
= cgpointmake(0
, 0);
gradientlayer.
endpoint
= cgpointmake(1
, 1);
//設定顏色陣列
gradientlayer.
colors
= @[
(__bridge
id)[
uicolor
colorfromhexcode
:@"0488e5"
].cgcolor,
(__bridge
id)[
uicolor
colorfromhexcode
:@"#20bcf4"
].cgcolor];
//設定顏色分割點(範圍:
0-1)
gradientlayer.
locations
= @[@(0.0f)
, @(1.0f)]
;
DIV背景色漸變
ie下 filter alpha opacity 100 finishopacity 100 style 1,startx 0,starty 0,finishx 100,finishy 50 progid dximagetransform.microsoft.gradient startcolors...
背景色漸變處理 linear gradient
處理各個瀏覽器間的相容,背景色漸變 background moz linear gradient top,0192ed 0 0baeb3 100 background webkit gradient linear,left top,left bottom,color stop 0 0192ed co...
背景色勻速漸變顯示
1 背景色勻速漸變顯示 ransition 顏色 變換延續的時間 變換速率 transition background color 0.3s linear 變換速率 1 ease 逐漸變慢 預設值,ease函式等同於貝塞爾曲線 0.25,0.1,0.25,1.0 2 linear 勻速 linear...