[self.layer addSublayer:[self shadowAsInverse]];
- (CAGradientLayer *)shadowAsInverse
{
CAGradientLayer *newShadow = [[[CAGradientLayer alloc] init] autorelease];
CGRect newShadowFrame =self.frame;
newShadow.frame = newShadowFrame;
//添加渐变的颜色组合
newShadow.colors = [NSArray arrayWithObjects:(id)[UIColor whiteColor].CGColor,(id)[UIColor grayColor].CGColor,nil];
return newShadow;
}
时间: 2024-11-07 21:48:10