I want to have a thin gray border around a UITextView
. I have gone through the Apple documentation but couldn\'t find any property there. Please help.
I believe the above answers are for the previous versions of Swift. I Googled a bit and the below code works for Swift 4. Just sharing it for whoever it may benefit.
self.textViewName.layer.borderColor = UIColor.lightGray.cgColor
self.textViewName.layer.borderWidth = 1.0
self.textViewName.layer.cornerRadius = 8
Happy Coding!
I solved this problem in storyboard by putting a fully disabled UIButton
behind the UITextView
and making the background color of the UITextView
clearColor. This works without requiring extra code or packages.