0

I am currently working on building up a view which shows icons, and text labels to the right of the icons. After some searching, I've decided that an IKImageBrowserView is most suitable. As such, I've gone ahead and created my IKImageBrowserView and set it's data source as follows:

// Setup image browser view
IKImageBrowserView *browser = [IKImageBrowserView new];

// Build our datasource delegate
MyDataStore *ds = [[MyDataStore alloc] init];
[browser setDelegate:ds];
[browser setDataSource:ds];

NSImage *image    = // . . . File path
NSString *imageID = // . . . Filename
IKBBrowserItem *item = [[IKBBrowserItem alloc] initWithImage:image imageID:imageID];
[[ds images] addObject:item];

I've also created my data source, implementing the two required methods in the protocol:

import "MyDataStore.h"

@implementation MyDataStore

- (id) init {  
    if ([super init] != nil) {
               images = [NSMutableArray new];
    }

    return self;
}

- (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser {  
  return [images count];
}

- (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index {
  return [images objectAtIndex:index];
}

- (NSMutableArray *) images {
  return images;
}

@end

However, when I try and add an item (as shown in the first block of code), nothing shows up in my IKImageBrowserView. I suspect I'm doing something glaringly incorrect with this view. Anyone know what that may be?

Julio
  • 2,261
  • 4
  • 30
  • 56

0 Answers0