我有以下代码片段以编程方式创建NSSearchField
mysearchField = [ [ NSSearchField alloc ] init];
[[mysearchField cell] setPlaceholderString:@"Page Number & Press Enter"];
[myView addSubview: mysearchField ];
[mysearchField resignFirstResponder];
[mysearchField release];
[mysearchField setDelegate:self];
这里我试图将resignFirstResponder转换为mysearchField,但是mysearchField仍然专注于应用程序启动。
我错过了什么吗
[myView.window makeFirstResponder:nil];
永远不要直接调用resignFirstResponder。