Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border around UITextView

How do you add a border around a UITextView (like a UITextField)? I want to allow users to type multiple lines, but unfortunately a UITextField does not support this. Is there an easy way to do this in code or do I need to create one in Photoshop?

like image 941
Jack Avatar asked Jul 06 '11 20:07

Jack


1 Answers

 #import <QuartzCore/QuartzCore.h>  

Import the above framework and include these lines in your class where textview is defined.

[[self.textview layer] setBorderColor:[[UIColor grayColor] CGColor]]; [[self.textview layer] setBorderWidth:2.3]; [[self.textview layer] setCornerRadius:15]; 

Swift solution.

self.textview.layer.borderColor = UIColor.gray.cgColor               self.textview.layer.borderWidth = 2.3                 self.textview.layer.cornerRadius = 15 
like image 75
Krishna Shanbhag Avatar answered Sep 22 '22 14:09

Krishna Shanbhag