内阴影路径斯威夫特2

时间:2016-04-04 02:27:56

标签: swift shadow cashapelayer

我无法在Swift中找到内部阴影方法。

这是我试图重新创建的图片:

所以,我创建了一个let shadowPath = UIBezierPath(arcCenter: CGPoint(x: viewRect.maxX-(viewRect.height/2),y: viewRect.height/2), radius: (frame.size.height-6)/2.0, startAngle: CGFloat(0), endAngle:CGFloat(M_PI * 2), clockwise: true).CGPath let shadowLayer = CAShapeLayer() shadowLayer.fillColor = UIColor.clearColor.CGColor shadowLayer.shadowPath = shadowPath shadowLayer.path = shadowPath shadowLayer.shadowRadius = 6 shadowLayer.shadowOpacity = 1 shadowLayer.shadowColor = UIColor(white: 0, alpha: 1).CGColor shadowLayer.shadowOffset = CGSizeZero 和添加阴影,但它不起作用。

$user

0 个答案:

没有答案