Your data source needs to return items to the image browser view that conform to the IKImageBrowserItem
protocol. Your myImageObject class is a good place to start with that.
In that protocol, three methods are required:
imageUID
: Returns a string that uniquely identifies this item (image).imageRepresentationType
: Returns a constant string that identifies howimageRepresentation
represents the image.imageRepresentation
: Returns an object that represents the image.
For a start, I'd just use the path that you're already giving every myImageObject. You can use that as both the identifier string and the image representation.
Depending on what else you're doing in this app, you may find it advantageous later on, for memory and/or speed reasons, to load each image yourself. If, after profiling, you do come to that conclusion, you can load the image yourself as an NSImage or CGImage, change your representation type appropriately, and return the image as the representation.
As the data source, you'll return the number of items in your _importedImages
array, and, when asked for the item at an index, return that item via objectAtIndex:
.
More info: