views:

19

answers:

1

How do you make the background of an IKImageBrowserView transparent? There seems to be no background color option in interface builder.

What I've tried:

I've never used Core Animation, but I saw IKImageBrowserView has a setBackgroundLayer method, so I tried the following, which had no effect:

CALayer* layer = [CALayer layer];
[layer setFrame: NSMakeRect(0, 0, 1000, 1000)];
[layer setBackgroundColor: CGColorCreateGenericRGB(0.0f, 0.0f, 0.0f, 0.0f)];
[browser setBackgroundLayer: layer];

Here's the class reference for IKImageBrowserView.

+2  A: 

Key Value Coding. See: IKImageBrowserView's View Options Section

[_imageBrowser setValue:[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:0.0] forKey:IKImageBrowserBackgroundColorKey];

Source.

peelman
Perfect, thank you! I called that in awakeFromNib from my IKImageBrowserView's controller and it worked.
Max