我想UIView在Cocoa Touch 的底部边缘画一个阴影.我明白我应该用CGContextSetShadow()它画阴影,但Quartz 2D编程指南有点模糊:
CGContextSetShadow,传递适当的值.我在UIView子类中尝试了以下内容:
- (void)drawRect:(CGRect)rect {
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextSaveGState(currentContext);
CGContextSetShadow(currentContext, CGSizeMake(-15, 20), 5);
CGContextRestoreGState(currentContext);
[super drawRect: rect];
}
Run Code Online (Sandbox Code Playgroud)
..但这对我不起作用,我有点不知道(a)下一步该去哪里,(b)如果有什么我需要做的让我UIView做这个工作?