Reputation: 315
I am using swift 2.0, I am trying to make a view's left top corner and bottom left corner rounded, so I used
init(roundedRect:byRoundingCorners:cornerRadii:)
However, the result is strange, only the left top corner is rounded, the bottom left corner is not working.
here is my code:
let maskPath = UIBezierPath(roundedRect: cell.statusView.bounds, byRoundingCorners: [UIRectCorner.TopLeft , UIRectCorner.BottomLeft], cornerRadii: CGSizeMake(10.0, 10.0)).CGPath
let maskLayer = CAShapeLayer()
maskLayer.path = maskPath
maskLayer.frame = cell.statusView.frame
cell.statusView.layer.mask = maskLayer
Upvotes: 1
Views: 174
Reputation: 315
Sorry, I found my own mistake, the problems comes out from the frame and bounds, just change
maskLayer.frame = cell.statusView.frame
into
maskLayer.frame = cell.statusView.bounds
Upvotes: 2