渐变

[view.layer addSublayer:[self shadowAsInverse]];



- (CAGradientLayer *)shadowAsInverse

{

CAGradientLayer *newShadow = [[CAGradientLayer alloc] init];

CGRect newShadowFrame = CGRectMake(0,0, kScreenWidth,70);

newShadow.frame = newShadowFrame;

newShadow.colors = [NSArray arrayWithObjects:

(id)[[UIColor colorWithRed:0x3e/255.0fgreen:0xcb/255.0fblue:1alpha:1.0] CGColor] ,

(id)[[UIColor colorWithRed:0x30/255.0fgreen:0x77/255.0fblue:1alpha:1.0] CGColor],

nil];

return[newShadow autorelease];

}

你可能感兴趣的:(渐变)