doc92606
doc92606

Reputation: 701

How to add PlaceHolders in TextFields after you clear the text

I have a button that clears all my textfields, but after they are cleared, I want to immediately replace the placeholders. However, my code doesn't work and the textfields remain blank after they are cleared. This is what I've tried:

[self clearTextFields];     
personWhoOwesYouMoney.placeholder = @"Person who owes you";
amtTheyOwe.placeholder = @"Amount Owed (USD)";
cellNum.placeholder = @"Their cell number";

my clearTextFields method is just a function that returns void which just sets all the textfields.text to @" "

I also tried putting the code in ViewdidLoad and that didn't work either. I have manually entered placeholders in the storyboard. All I'm trying o do is retrieve those same placeholders after I clear my textfields.

Upvotes: 0

Views: 79

Answers (1)

Graham Perks
Graham Perks

Reputation: 23398

You're setting the fields' text to @" " - which is a space. Instead, set them to @"" (no space between the quotes).

Upvotes: 2

Related Questions