【发布时间】:2018-07-19 01:07:32
【问题描述】:
For UIView 我给出了两侧的圆角半径并添加了阴影。现在,我得到了两侧的圆角半径,而不是阴影。
这是我使用的代码:
@IBOutlet var myView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
let shadowpath = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width:
myView.frame.height, height: myView.frame.height), byRoundingCorners:
[.topRight, .bottomRight], cornerRadii: CGSize(width: 58.0, height: 0.0))
myView.layer.shadowColor = UIColor.black.cgColor
myView.layer.shadowOffset = CGSize(width: 0.5, height: 0.4) //Here you
control x and y
myView.layer.shadowOpacity = 0.5
myView.layer.shadowRadius = 5.0 //Here your control your blur
myView.layer.masksToBounds = false
myView.layer.shadowPath = shadowpath.cgPath
【问题讨论】:
-
请显示该代码的其余部分。你也屏蔽图层吗?绘制圆角形状的代码在哪里?
-
期望什么?我看不出有什么问题。
-
@user28434 应为屏幕截图结果
-
好的,那么你能展示一下现在发生了什么吗?就像当前状态截图一样。
-
@user28434 是的,当然!