iOS 将控件设置为一边圆角一边直角


//UIButton为例

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:button.bounds byRoundingCorners:UIRectCornerBottomRight | UIRectCornerTopRight cornerRadii:CGSizeMake(20, 20)];

    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

    maskLayer.frame = button.bounds;

    maskLayer.path = maskPath.CGPath;

    button.layer.mask = maskLayer;


你可能感兴趣的:(iOS)