tags:

views:

55

answers:

0

Hi,

I'm seeing some weird things reloading the data in my IKImageBrowserView in my garbage collected, Leopard app. Basically depending on how I change the contents of my "filteredItems" NSMutableArray I get a different loading behaviour.

If I refresh the contents like this the IKImageBrowserView seems to ignore the imageUID and reload everything again:

   [self.filteredItems setArray: self.prefilteredItems];
   [imageBrowserView reloadData];

while if I do the much more elaborat following it seems to reuse everything properly and doesn't do the weird reloading of everything:

NSMutableArray *array = [NSMutableArray arrayWithCapacity: [self.filteredItems count]];
for(id obj in self.filteredItems){
   if(![self.prefilteredItems containsObject: obj])[array addObject: obj];
}
[self.filteredItems removeObjectsInArray: array];

for(id obj in self.prefilteredItems){
   if(![self.filteredItems containsObject: obj])[self.filteredItems addObject: obj];
}

Any idea why this is? How come the imagebrowserview seems to monitor my mutablearray? Also, any tips on how to solve the issue, or a workaround? The above one is (too) slow.

I have done everything accoding to the ImageKit demo, including implementing imageUID in my model object, and implementing the delegates as follows:

- (NSInteger)numberOfItemsInImageFlow:(IKImageFlowView*)view{
   return [filteredItems count];
}

- (id)imageFlow:(IKImageFlowView *) view itemAtIndex:(NSInteger) index{
       return [filteredItems objectAtIndex:index];
}