Skip navigation.
 
mlRe: Troubles with CollectionView and IKImageBrowserView
FROM : Manuel
DATE : Thu Jun 12 22:28:31 2008

Thank you for your tips! But I didn't understand everything. Do you 
tried this in a sampleproject which you can send me?

If I initialize the imageBrowser in my MYNSCollectionViewItem and set 
the datasource, the datasource methods will now be called correctly. 
Thank you. But it seems that the IKImageBrowserView which is displayed 
will not display anything, even if I reload the imageBrowser data 
manually:

- (id)initWithCoder:(NSCoder *)decoder {
   imageBrowser = [[IKImageBrowserView alloc] init];
   [imageBrowser setDataSource:self];    
   return self;
}


// 
-------------------------------------------------------------------------
//    numberOfItemsInImageBrowser:view
// 
-------------------------------------------------------------------------
- (int)numberOfItemsInImageBrowser:(IKImageBrowserView*)view
{
   MyObject *representedObject = [self representedObject];
   return [representedObject.myImages count];
}

// 
-------------------------------------------------------------------------
//    imageBrowser:view:index:
// 
-------------------------------------------------------------------------
- (id)imageBrowser:(IKImageBrowserView *) view itemAtIndex:(int) index
{
   MyObject *representedObject = [self representedObject];
   return [representedObject.myImages objectAtIndex:index];
}

- (IBAction)refreshView:(id)sender {
   [imageBrowser reloadData];
}

Regards...Manu


On Jun 12, 2008, at 16:32 , Jens Alfke wrote:

>> I got it working like this:
>> - put your custom view initialisation in initWithCoder: (as that is 
>> the one used to copy the original instance / unarchive your nib)

You mean my customized NSCollectionView, didn't you?
>

>> - in your view, have an IBOutlet that's connected to the 
>> NSCollectionViewItem instance (called cvItem in my case)
>> - in awakeFromNib bind the properties you're interested in (as 
>> these get restored / set correctly in the cloning process), e.g.
>> - (void)awakeFromNib

-I don't need this do I?

>>
>> {
>>     [self bind:@"plotRoot" toObject:cvItem 
>> withKeyPath:@"representedObject" options:nil];
>>
>>     [self bind:@"isSelected" toObject:cvItem withKeyPath:@"selected" 
>> options:nil];
>> }

Related mailsAuthorDate
mlTroubles with CollectionView and IKImageBrowserView Manuel Jun 11, 22:14
mlRe: Troubles with CollectionView and IKImageBrowserView Jens Alfke Jun 12, 00:25
mlRe: Troubles with CollectionView and IKImageBrowserView Manuel Jun 12, 08:04
mlRe: Troubles with CollectionView and IKImageBrowserView Daniel Vollmer Jun 12, 09:19
mlRe: Troubles with CollectionView and IKImageBrowserView Jens Alfke Jun 12, 16:32
mlRe: Troubles with CollectionView and IKImageBrowserView Manuel Jun 12, 22:28