我有一个UIView名为父。内部父嵌套命名Child1和CHILD2 2个UIViews(见图像) Swift 3:嵌套UIView拐角不变圆
注意:有无边距即0余量的B/W两者Child1,CHILD2和父。
我想要围绕着父的角落。
parentView.layer.cornerRadius = 10
这不圆了孩子们的角落。(见图片)
的顶部边角做不最终得到轮这里。底角被舍入,因为Child2是透明的,而Child1是彩色的。父母是白色的。
我试过到目前为止:
parentView.layer.cornerRadius = 10
child1.clipsToBounds = true
没有运气
parentView.layer.cornerRadius = 10
let maskLayer = CAShapeLayer()
maskLayer.path = UIBezierPath(roundedRect: view.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 10, height: 10)).cgPath
child1.layer.mask = maskLayer
仍然没有运气
请帮我
集.clipsToBounds =真。这将隐藏图层 –
子项和父项两者的溢出RadRadius和clipsToBounds = true – Rex
将父图层的“masksToBounds”设置为true。 –