0

I have a UITextField subclass that contains a UITextView used to display some text below the UITextField.

I'm trying to round bottom two corners of the UITextView with the following code but for some reason it's disappearing.

let maskPath = UIBezierPath(roundedRect: textView.bounds, 
                      byRoundingCorners: ([.bottomRight, .bottomRight]), 
                            cornerRadii: CGSize(width: 10.0, height: 10.0))
let maskLayer: CAShapeLayer = CAShapeLayer()
maskLayer.frame = textView.bounds
maskLayer.path = maskPath.cgPath
textView.layer.mask = maskLayer

Why?

I'm using AutoLayout to place the textView beneath the textField - perhaps AutoLayout is clashing with what I have going on here? Or am I not setting the maskLayer's coordinates correctly?

elce
  • 264
  • 4
  • 16
  • 1
    See if this helps: http://stackoverflow.com/a/35811368/77567 – rob mayoff Oct 21 '16 at 21:34
  • That did it, thanks so much. I should have been thinking more about the view lifecycle while debugging. by the way, one of the greatest SO answers of all time - http://stackoverflow.com/a/25768875/3354041 – elce Oct 21 '16 at 21:54

0 Answers0