3

When you select an item in IKImageBrowserView it is highlighted grey around the edges. How do I change the color of this?

enter image description here

Chris
  • 1,005
  • 1
  • 13
  • 27

3 Answers3

0

Take a look at the "View Options Keys" in the IKImageBrowserView documentation. I think that IKImageBrowserSelectionColorKey should do the trick.

So you code will be something like this in awakeFromNib of your view controller:

[imageBrowserView setValue:[NSColor blueColor] forKey:IKImageBrowserSelectionColorKey];
combinatorial
  • 9,132
  • 4
  • 40
  • 58
  • This changes the color of the title highlight. What I'm looking for is the highlight of the image view. I have updated my question with a picture of what I'm talking about. – Chris Aug 14 '12 at 21:57
  • 2
    To get that effect then I think you have to go the complex route. You need to implement a custom IKImageBrowserView class that implements -(IKImageBrowserCell *)newCellForRepresentedItem:(id)anItem and that method need to return a custom cell object that implements -(CALayer *)layerForType:(NSString *) type. see http://developer.apple.com/legacy/mac/library/#samplecode/ImageKitDemo/Listings/Step7_ImageBrowserCell_m.html – combinatorial Aug 15 '12 at 04:53
0
[imageBrowserView setValue:[NSColor blueColor] forKey:IKImageBrowserCellsOutlineColorKey];
CocoaBob
  • 533
  • 4
  • 9
0

So I was able to achive what I was looking for by going the complex route that combinatorial suggested (Thanks!). I implemented the custom IKImageBrowserView and IKImageBrowserCell classes from the sample project here: http://developer.apple.com/library/mac/#/legacy/mac/library/samplecode/ImageKitDemo/Introduction/Intro.html

Too bad there isn't an easier way to do this but this will do the trick for now.

Chris
  • 1,005
  • 1
  • 13
  • 27