Reset NSTextField's text to empty string — setText: doesn't work

后端 未结 2 2104
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 04:30

I have an NSTextField, and I need a button to reset the text of the field. How would I do that? I have been trying this:

[textBox setText:@\"\"];
te         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 05:12

    Try this code:

    theLabel.text = @"this is some text";
    [self.view addSubView:theLabel];
    

    Here, the label is the text field.

提交回复
热议问题