I am trying to round the upper and lower border of two UITextField
Result ViewDidLoad()

Result in ViewDidAppear

The task ViewDidAppearforces the border to change after half a second of loading the view, which is not very good in my situation,
Does anyone know why it only rounds the left corner in a method ViewDidLoad?
any suggestions?
* Update *
viewDidLayoutSubviews coincides with ViewDidLoad
Here is the code I use to round corners
extension UITextField {
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.CGPath
self.layer.masksToBounds = true
self.layer.mask = mask
}
}
AND
self.FirstTextField.roundCorners(UIRectCorner.TopRight | UIRectCorner.TopLeft, radius: 10.0)
self.SecondTextField.roundCorners(UIRectCorner.BottomLeft | UIRectCorner.BottomRight, radius: 10.0)
source
share