How to fix focus ring selection when using CALayer?

The contentView window has NSTextFields. (Macos)

I use the interface constructor to customize the window and its functions, so there is nothing in awakeFromNib other than this:

[[self.window contentView] setWantsLayer:YES];
CALayer *layer = [[self.window contentView] layer];
CGColorRef lightGray = CGColorCreateGenericGray(0.93, 1.0);
[layer setBackgroundColor:lightGray];
CGColorRelease(lightGray);

However, the focus ring of the textField does not appear outside the textField field.

With a layer:

Without layer:

I think this display problem is something more than this, but I cannot find an example of this problem (and solution).

is anyone

+5
source share
1 answer

- Cocoa -dev 2008 . . NSView , CALayers. Leopard AppKit , , .

, , . , , , NSTextField, , . , , . ( 4 .)

, , , . NSView setWantsLayer: docs:

.

. , , :

, .

.

( SO : Layer-Layer Layer-Hosting Views)

+4

All Articles