0

How can I create UITextField based on a user input in swift

I tried to do it but it's not possible to drag and drop so many text fields !

For example, I've a UITextField if a user enter 5< for example, then a 5 UITextField's will be created I need it in another view controller and I need to control them separately how can I do it ?

@IBOutlet weak var numberOfTextFields: UITextField!

@IBAction func the_action_button(sender: AnyObject) {
 // ?
}
2
  • You can add these functionality by using tableview, simply put textfield into tableview cell and add cell based on your requirement Commented Nov 7, 2017 at 7:31
  • Please read apple docs, swift docs. Check how components are created programmatically and how loops and control statements work, how tags are assigned to views and how these views are accessed using these tags. This question right now is too broad for help. Commented Nov 7, 2017 at 7:32

1 Answer 1

1

I guess you can use tableView, and create a cell with a text field in it. And when a user enters 5 in your text field that would mean that table view should have 5 rows. Or you can create those 5 text fields from code not from interface builder.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.