NSTextField placeholder text doesn't show unless editing

前端 未结 3 2051
清歌不尽
清歌不尽 2021-01-17 09:30

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.

3条回答
  •  忘掉有多难
    2021-01-17 10:07

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

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

提交回复
热议问题