i am trying to round the top and the bottom border of two UITextField
The result in ViewDidLoad()
The result in ViewDidAppear
The problem is ViewDidAppear
makes the border changes after half a sec of loading the view which is not good in my situation ,
any one knows why it's only rounding the left corner in ViewDidLoad
method ?
any suggestions appreciated ?
* Update *
viewDidLayoutSubviews
is the same as ViewDidLoad
Here is the code i use to round the 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)