1

I am new to cocoa.. I am creating one of the colorful window. so I need set background color to IKImageBrowserView. I think subclassing IKImageBrowserView is the way to set background color but it is too difficult for me.. Any other way to set background color without subclassing?

Justin Boo
  • 10,132
  • 8
  • 50
  • 71
NewStack
  • 990
  • 8
  • 19

2 Answers2

7

You can achieve what You want by using setValue:forKey with option key IKImageBrowserBackgroundColorKey like this:

[imageBrowserViewOutlet setValue:[NSColor redColor] forKey:IKImageBrowserBackgroundColorKey];

Note: imageBrowserViewOutlet is IKImageBrowserView outlet.

Justin Boo
  • 10,132
  • 8
  • 50
  • 71
0

You can do that by using:

[thumbnailBrowser setValue:[NSColor colorWithDeviceRed:0.125f green:0.145f blue:0.145f alpha:1.0f]   forKey:IKImageBrowserBackgroundColorKey];

Change RGB as you like. thumbnailBrowser is IKImageBrowserView. Gook luck!

bensiu
  • 24,660
  • 56
  • 77
  • 117
Rockmen
  • 1
  • 2