Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone text input with rounded edges

Is there an obvious way to make a text input box that has rounded edges?

I'm not talking about setting a UITextField's borderStyle to UITextBorderStyleRoundedRect. That only gives me rounded corners.

I'm talking about the style text field used as input in the SMS app (before you hit send), or the UISearchBar. I've also seen it used in 3rd party applications (for example, the comment input box in the Facebook application).

Is this possible using standard Cocoa Touch? Or do I have to bring my own background images to the table?

like image 326
MikeQ Avatar asked Feb 02 '10 14:02

MikeQ


2 Answers

You can also set the corner radius on the textField, which might give you enough control to get the look you want:

textField.layer.cornerRadius = 10;

Be sure to include #import <QuartzCore/QuartzCore.h> to access this.

(the above answer it probably a better answer; this just might be easier)

like image 75
justin Avatar answered Oct 06 '22 00:10

justin


for iPhone text input with rounded edges,

  1. include - #import <QuartzCore/QuartzCore.h> to access this

  2. textField.layer.cornerRadius = 10;

this is the best and simple way to make rounded edge of the UITextField.

like image 24
Himanshu padia Avatar answered Oct 05 '22 23:10

Himanshu padia