UI部分圆角

OC

        /**设置圆角*/
        [view.layer setMasksToBounds:YES];
        [view.layer setCornerRadius:6];
        view.layer.maskedCorners = (CACornerMask)(UIRectCornerTopRight|UIRectCornerBottomLeft);

![image.png](https://upload-images.jianshu.io/upload_images/2782369-872618ad2b9e20f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

Swift

// 假设我的View的名称是myView

// 1. 定义圆角
myView.layer.cornerRadius = 10.0
// 2. 选择需要实现圆角的角
myView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]
// 左上角 - .layerMinXMinYCorner
// 右上角 - .layerMaxXMinYCorner
// 左下角 - .layerMinXMaxYCorner
// 右下角 - .layerMaxXMaxYCorner

你可能感兴趣的:(UI部分圆角)