Question

We've got an IKImageBrowserView that displays a bunch of images. We asynchronously download those images in the background and cache them to disk. We then notify the IKImageBrowserView that the imageRepresentation has changed using KVC. e.g. didSetValueForKey:@"ImageRepresentation". However, it looks like IKImageBrowserView will only refresh itself to load the recently downloaded images if user scrolls the view (We embedded IKImageBrowserView inside an NSScrollView). Why is this the case? Is there anyway to force IKImageBrowserView to redraw a certain cell or all visible cells without waiting for user to scroll the view?

Was it helpful?

Solution

Try using the reloadData method.

    [browser reloadData];

I've got a similar situation in which I am using a IKImageBrowserView to view images that are downloading. In my case, I create the initial set of images with a placeholder image and then download the image. As each comes in, I update the data source entry with a different image, increase the image version number, then use the reloadData method on the browser. I also turn off animations so that the user doesn't see the entire browser redraw, only the images that have been updated.

- (void) setImage: (NSImage *) image
{

    [img release];
    img = image;
    [img retain];
    imageVersion++;
}

The above is a setter method for my data item that implements the informal protocol.

https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/IKImageBrowserItem_Protocol/IKImageBrowserItem_Reference.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top