用于 iOS 的内部阴影 UIView/CALayer。
YIInnerShadowView* innerShadowView = [[YIInnerShadowView alloc] initWithFrame:frame];
innerShadowView.shadowRadius = 5;
innerShadowView.shadowMask = YIInnerShadowMaskVertical;
[self.view addSubview:innerShadowView];
typedef enum {
YIInnerShadowMaskNone = 0,
YIInnerShadowMaskTop = 1 << 1,
YIInnerShadowMaskBottom = 1 << 2,
YIInnerShadowMaskLeft = 1 << 3,
YIInnerShadowMaskRight = 1 << 4,
YIInnerShadowMaskVertical = YIInnerShadowMaskTop | YIInnerShadowMaskBottom,
YIInnerShadowMaskHorizontal = YIInnerShadowMaskLeft | YIInnerShadowMaskRight,
YIInnerShadowMaskAll = YIInnerShadowMaskVertical | YIInnerShadowMaskHorizontal
} YIInnerShadowMask;
主要想法来自 Matt Wilding
http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer
YIInnerShadowView
在 Beerware 许可证下可用。
如果我们某天见面,你认为这个项目有它的价值,那么你可以请我喝一杯啤酒来作为回报。