Question

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.

Was it helpful?

Solution

[myView.window makeFirstResponder:nil]; Never call resignFirstResponder directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top