NSSearchFiled 辞职第一响应者
我有以下代码片段以编程方式创建 NSSearchField
mysearchField = [ [ NSSearchField alloc ] init];
[[mysearchField cell] setPlaceholderString:@"Page Number & Press Enter"];
[myView addSubview: mysearchField ];
[mysearchField resignFirstResponder];
[mysearchField release];
[mysearchField setDelegate:self];
这里我试图将 FirstResponder 交给 mysearchField,但 mysearchField 仍然专注于应用程序启动。
我是不是错过了什么?
I have following code snippet to create NSSearchField programmatically
mysearchField = [ [ NSSearchField alloc ] init];
[[mysearchField cell] setPlaceholderString:@"Page Number & Press Enter"];
[myView addSubview: mysearchField ];
[mysearchField resignFirstResponder];
[mysearchField release];
[mysearchField setDelegate:self];
Here I am trying to resignFirstResponder to the mysearchField,But mysearchField is still focussing on application launch.
Am I missing some thing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[myView.window makeFirstResponder:nil];
切勿直接调用 resignFirstResponder。[myView.window makeFirstResponder:nil];
Never call resignFirstResponder directly.