Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 NSTextField 上按 Enter 以发送文本字段中的内容时,它会发送它,但会突出显示 NSTextField 中的内容。有谁知道如何制作它,以便一旦它发送命令,它会删除 NSTextField 中的内容?
谢谢,以利亚
如果您还没有,请将目标和操作分配给文本字段。这是您的操作方法:
- (IBAction)sendText: (id)sender { // Whatever else you were doing. // ... // Add this: [sender setStringValue: @""]; // Optionally, to make it *not* the first responder: [[sender window] makeFirstResponder: nil]; }