Moban K Michael
Moban K Michael

Reputation: 3

Clear text of UITextField in UITableView cell on button press

I have a table view with two rows, each with a text field. One text field is for username and the other for password. When I click on a button, I want to clear both fields and replace the contents with the intial placeholders. I tried [mytableview reloadData];. That just reloads the table view; the text fields are not cleared. The placeholders are appearing over the text entered while editing the text field, and the next time I try to edit the text field, the text is drawn over the first text.

Upvotes: 0

Views: 6556

Answers (1)

Gypsa
Gypsa

Reputation: 11314

on your button click:- do yourtextfieldname.text=@"";

or if you have made a text field in table view methods so in that condition on your button click do [tableView reloadData] and at cellForRowAtIndexPath write yourtextfieldname.text=@""; and set placeholder also.

Upvotes: 1

Related Questions