Rounded Corners only on Top of a UIView

后端 未结 10 1910
别跟我提以往
别跟我提以往 2020-11-29 22:53

Hi i am searching a clean solution without overwriting drawRect or stuff like that to create a UIView with Rounded corners on the Top of the

10条回答
  •  离开以前
    2020-11-29 23:19

     CAShapeLayer * maskLayer = [CAShapeLayer layer];
        maskLayer.path = [UIBezierPath bezierPathWithRoundedRect: registerbtn.bounds byRoundingCorners: UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii: (CGSize){9.0, 12.0}].CGPath;
    
        registerbtn.layer.mask = maskLayer;
    

    this will do only one corner rounded

提交回复
热议问题