adamcircle
adamcircle

Reputation: 724

Is it possible to make a UITextField without rounded edges?

Rounded edges are getting kind of old, and I want my program to have a modern edge. Any idea how this can be done?

To clarify: I want the exact functionality of UITextField without rounded corners.

EDIT: Sorry, I'm a dumbass. I couldn't find the button because the textbox wasn't selected.

{insert facepalm emoticon here}

Upvotes: 4

Views: 3250

Answers (5)

Darkseal
Darkseal

Reputation: 9564

Just to help anyone who still runs into this, since it isn't clear enough you can use the Storyboard/Xib Interface Builder:

enter image description here

Upvotes: 8

Andrew Aarestad
Andrew Aarestad

Reputation: 1170

You can modify a standard UITextView created in Interface Builder in viewDidLoad as follows:

[_textField setBorderStyle:UITextBorderStyleNone];
[_textField setBackgroundColor:[UIColor whiteColor]];  

This can also be set the border style and background color directly in Interface Builder.

Upvotes: 1

The Muffin Man
The Muffin Man

Reputation: 20004

You need to set a background image and the background color.

UITextField *txtSearchField = [self.searchDisplayController.searchBar valueForKey:@"_searchField"];
[txtSearchField setBackgroundColor:[UIColor whiteColor]];
[txtSearchField setBackground:[[UIImage alloc]init]];

Upvotes: -1

Xcoder
Xcoder

Reputation: 1807

Subclass UITextfield and override the drawrect: method. I think this should solve your problem.

Upvotes: 1

Daniel
Daniel

Reputation: 22405

You can just change the borderStyle property of your UITextfield, or provide your own background image by setting backgroundImage property, here is a ref UITextField reference

Upvotes: 2

Related Questions