ThunderHorse
ThunderHorse

Reputation: 375

Style for textField added as subview to cell

In my current iOS project I have added a dynamic cell to my tableView with a label and a textField. I am using the following code to make the textField:

UITextField *inputField;
inputField = [[UITextField alloc] initWithFrame:CGRectMake(120,12,185,30)];
inputField.textAlignment = UITextAlignmentRight;
inputField.adjustsFontSizeToFitWidth = YES;
inputField.placeholder = @"your text here...";
[cell addSubview:inputField];

The results look like this:

tableView cells

My question is how do I style the code generated textFields to look like a regular IB textField?

Upvotes: 0

Views: 156

Answers (1)

A-Live
A-Live

Reputation: 8944

inputField.borderStyle = UITextBorderStyleRoundedRect;

Here is the borderStyle property reference for you to check.

Upvotes: 2

Related Questions