Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display PlaceHolder Text

I have a countdown timer textfield that displays 60 as a placeholder (grey). When I start the timer, it goes black and starts counting down. At the end, I invalidate the timer and set the countdown textfield back to 60. Of course, it's black now. How do I get it back to the placeholder text of 60 (meaning that it's grey) without resorting to a hack using NSAttributedString?

like image 246
Walker Avatar asked Dec 20 '25 02:12

Walker


1 Answers

If you are using the "value" binding on the NSTextField, you will need to set the Null Placeholder for the binding instead of for the text cell's placeholder. The empty string (@"" ) does seem to count as a null value for the purposes of the placeholder.

like image 82
natevw Avatar answered Dec 22 '25 19:12

natevw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!