【发布时间】:2024-01-16 09:03:01
【问题描述】:
所以我有一个 UIView(称为 myView),上面应用了一些掩码。
let maskPath = UIBezierPath(roundedRect: myView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 12, height: 12))
let maskLayer = CAShapeLayer()
maskLayer.frame = myView.bounds
maskLayer.path = maskPath.cgPath
myView.layer.mask = maskLayer
这种布局方式:
我没有做的是向 myView 添加一些阴影。由于视图的图层有一个蒙版,我无法使用阴影向它添加不同的图层。
有人遇到过这个问题吗?
【问题讨论】:
-
你可以试试这个*.com/questions/39624675/…
标签: ios swift uiview calayer shadow