Change Background Color of IKImageBrowserView

  • Is there a way to change the background color of an IKImageBrowserView
    to something other than white?

    I've tried subclassing it and doing this in -drawRect:

    - (void)drawRect:(NSRect)rect {

    [super drawRect:rect];
    [[NSColor blackColor] set];
    [NSBezierPath fillRect:rect];
    }

    but doesn't seem to make a difference..

    Michael
  • Hi Michael,

    You don't need to subclass to do this. Just use setValue:forKey with
    the option key "IKImageBrowserBackgroundColorKey" :

    [_imageBrowser setValue:[NSColor blackColor]
    forKey:IKImageBrowserBackgroundColorKey];

    other keys are :
    extern NSString * const IKImageBrowserBackgroundColorKey;                    /
    *NSColor*/
    extern NSString * const IKImageBrowserSelectionColorKey;                    /*NSColor*/
    extern NSString * const IKImageBrowserCellsOutlineColorKey;                    /
    *NSColor*/
    extern NSString * const IKImageBrowserCellsTitleAttributesKey;                /
    *NSDictionary*/
    extern NSString * const
    IKImageBrowserCellsHighlightedTitleAttributesKey;    /*NSDictionary*/
    extern NSString * const IKImageBrowserCellsSubtitleAttributesKey;            /
    *NSDictionary*/

    Documentation is here : http://developer.apple.com/graphicsimaging/imagekit/

    -- Thomas.

    On Jan 13, 2008, at 2:55 AM, Michael Hanna wrote:

    > Is there a way to change the background color of an IKImageBrowserView
    > to something other than white?
    >
    > I've tried subclassing it and doing this in -drawRect:
    >
    > - (void)drawRect:(NSRect)rect {
    >
    > [super drawRect:rect];
    > [[NSColor blackColor] set];
    > [NSBezierPath fillRect:rect];
    > }
    >
    > but doesn't seem to make a difference..
    >
    > Michael
  • thanks *sigh* was one of those things where I found the solution right
    *after* I pressed send heh

    Michael

    On Jan 13, 2008 2:58 AM, Thomas Goossens <tgoossens...> wrote:
    >
    > Hi Michael,
    >
    > You don't need to subclass to do this. Just use setValue:forKey with the
    > option key "IKImageBrowserBackgroundColorKey" :
    >
    > [_imageBrowser setValue:[NSColor blackColor]
    > forKey:IKImageBrowserBackgroundColorKey];
    >
    > other keys are :
    > extern NSString * const IKImageBrowserBackgroundColorKey; /*NSColor*/
    > extern NSString * const IKImageBrowserSelectionColorKey; /*NSColor*/
    > extern NSString * const IKImageBrowserCellsOutlineColorKey; /*NSColor*/
    > extern NSString * const IKImageBrowserCellsTitleAttributesKey;
    > /*NSDictionary*/
    > extern NSString * const IKImageBrowserCellsHighlightedTitleAttributesKey;
    > /*NSDictionary*/
    > extern NSString * const IKImageBrowserCellsSubtitleAttributesKey;
    > /*NSDictionary*/
    >
    > Documentation is here : http://developer.apple.com/graphicsimaging/imagekit/
    >
    > -- Thomas.
    >
    >
    >
    >
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today