Cocoa: How do you make the background of an IKImageBrowserView transparent?
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 IKImageBrows开发者_运维知识库erView.
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.
精彩评论