Domanda

I have a NSTextView:

NSTextView *textView = [[NSTextView alloc] init];
[textView setTranslatesAutoresizingMaskIntoConstraints:NO];

[textView setDrawsBackground:NO];
[textView setRichText:YES];
[textView setSelectable:YES];
[textView setEditable:YES];


return textView;

This textView is added to subclass of NSView, in initWithFrame: I call

[[self window] makeFirstResponder:self.textView];

Furthermore, the [self.textView acceptsFirstResponder] == YES

But, the selection in this textView becomes gray, input not working. When I press right mouse, menu pops up, and then behavior becomes like it was expected (the blue one with working input).

Where is the problem?

È stato utile?

Soluzione

The reason was some view pulling first responder to itself. Just use [[self window] firstResponder] to find whom to blame in a case you have same issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top