how to set cornerRadius for only bottom-left,bottom-right and top-left corner textview?

前端 未结 12 917
名媛妹妹
名媛妹妹 2020-11-27 12:50

How to set corner radius only only bottom-left,bottom-right and top-left corner textview?

let rectShape = CAShapeLayer()
    rectShape.backgroundColor = UICo         


        
12条回答
  •  感动是毒
    2020-11-27 13:09

    ez way

    for subview & POPUPs [Swift 5]

    override func layoutSublayers(of layer: CALayer) {
        searchBarPopup.clipsToBounds = true
        searchBarPopup.layer.cornerRadius = 10
        searchBarPopup.layer.maskedCorners = [ .layerMaxXMinYCorner, .layerMinXMinYCorner]
    }
    

    output:

    image

提交回复
热议问题