除非编辑,否则NSTextField占位符文本不显示 [英] NSTextField placeholder text doesn't show unless editing
本文介绍了除非编辑,否则NSTextField占位符文本不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Interface Builder中设置了NSTextField的占位符文本,但是在我单击文本字段以编辑它之前,占位符文本不会显示。有人遇到此问题吗?
I set the placeholder text of my NSTextField in Interface Builder, but the placeholder text doesn't show until I click inside the text field to edit it. Anyone else having this issue?
感谢
编辑以下是我不编辑字段时的字段:
Screenshots. Here's what the field looks like when I'm not editing it:
这是我编辑时的样子:
推荐答案
您是否尝试通过代码设置占位符?例如像这样:
Have you tried setting the placeholder through code? for example something like this:
[[textField cell] setPlaceholderString:@"hello"];
这篇关于除非编辑,否则NSTextField占位符文本不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文