Bordered UITextView

后端 未结 14 2228
一个人的身影
一个人的身影 2020-12-04 10:11

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.

14条回答
  •  星月不相逢
    2020-12-04 10:47

    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!

提交回复
热议问题