UIBezierPath仅由左上角和左下角RoundingCorners四舍五入?

时间:2016-03-17 11:15:01

标签: swift uikit uibezierpath cashapelayer

我需要在左上角和右上角设置圆角,但只有左下角和左上角有自动布局。

    let path = UIBezierPath(roundedRect: viewWithButtons.bounds, byRoundingCorners: UIRectCorner.TopLeft.union(.TopRight), cornerRadii: CGSize(width: 10, height: 10))
    let maskLayer = CAShapeLayer()
    maskLayer.frame = viewWithButtons.bounds
    maskLayer.path = path.CGPath
    viewWithButtons.layer.mask = maskLayer

这是结果:

result rounded

0 个答案:

没有答案