I am trying to round three corners of label and button by following this: rounded button
But the result is:
some corners of labels are rounding and some are not.Similarly its happening with button and width is exceeding and button going out of tableview.
this is the code of extension i am using:
extension UIButton{
func roundedButton(){
let maskPAth1 = UIBezierPath(roundedRect: self.bounds,
byRoundingCorners: [.topLeft, .bottomLeft, .bottomRight],
cornerRadii:CGSize(width:8,height:8))
let maskLayer1 = CAShapeLayer()
maskLayer1.frame = self.bounds
maskLayer1.masksToBounds=true
maskLayer1.path = maskPAth1.cgPath
self.layer.mask = maskLayer1
}
}
extension UILabel{
func roundedLabel(){
let maskPAth1 = UIBezierPath(roundedRect: self.bounds,
byRoundingCorners: [.topRight,.bottomRight,.bottomLeft],
cornerRadii:CGSize(width:10,height:10))
let maskLayer1 = CAShapeLayer()
maskLayer1.frame = self.bounds
maskLayer1.cornerRadius=5
maskLayer1.masksToBounds=true
maskLayer1.path = maskPAth1.cgPath
self.layer.mask = maskLayer1
}
}
I am calling these function in
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {}