使用CAGradientLayer
self
.
centerline
.
backgroundColor
= [
UIColor
clearColor
];
CAGradientLayer
*gradient = [
CAGradientLayer
layer];
gradient.
frame
=
self
.
centerline
.
bounds
;
gradient.
colors
= [
NSArray
arrayWithObjects:
(
id
)[
UIColor
whiteColor].CGColor,
(
id
)[
UIColor
lightGrayColor].CGColor,
(
id
)[
UIColor
whiteColor].CGColor,
nil
];
gradient.
startPoint
=
CGPointMake
(
0.0
,
0.0
);
gradient.
endPoint
=
CGPointMake
(
1.0
,
1.0
);
[self.centerline.layerinsertSublayer:gradient atIndex:0];
|