// // UIView+Corner.swift // Inhealth // // Created by weclouds on 2019/12/11. // Copyright © 2019 weclouds. All rights reserved. // import Foundation import UIKit extension UIView{ /// 部分圆角 /// /// - Parameters: /// - corners: 需要实现为圆角的角,可传入多个 /// - radii: 圆角半径 func corner(byRoundingCorners corners: UIRectCorner, radii: CGFloat) { let maskPath = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radii, height: radii)) let maskLayer = CAShapeLayer() maskLayer.frame = self.bounds maskLayer.path = maskPath.cgPath self.layer.mask = maskLayer } }