user1517223
user1517223

Reputation: 140

UITextField with Rounded Corner Without using background images

I Want to round the UITextField Corners, to display it something like this

rounded textfield

i want to do this programatically, not by using images.

Upvotes: 4

Views: 1132

Answers (1)

Nirav Limbasiya
Nirav Limbasiya

Reputation: 348

You can set the Corner-Radius on any UIView-Subclass.

  1. Add the QuartzCore framework to your project
  2. Add #import <QuartzCore/QuartzCore.h> in your UIViewController Subclass (where you have access to the UITextfield instance of your choice
  3. Within viewDidLoad / viewWillAppear (or any other place where your UITextfield is allready instantiated call [yourTextField.layer setCornerRadius:14.0f];
  4. Play around with the cornerRadius value until it looks good

I think this will help you.

Upvotes: 5

Related Questions