除非编辑,否则 NSTextField 占位符文本不会显示 [英] NSTextField placeholder text doesn't show unless editing

查看:24
本文介绍了除非编辑,否则 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.

推荐答案

您是否尝试过通过代码设置占位符?例如这样的事情:

Have you tried setting the placeholder through code? for example something like this:

    [[textField cell] setPlaceholderString:@"hello"];

这篇关于除非编辑,否则 NSTextField 占位符文本不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆