Right now I am working on a Startup Window for my document based application. The window's purpose is to give the user something visual to start with, instead of the menu bar.
The window contains a NSCollectionView
whose purpose is to show recent files. I did manage to get the recent documents in the collection view using a separate .xib
file as a reference NSCollectionViewItem
. My collection view has the Flow layout vertical.
However, the items don't look the way I want them too. In my storyboard I did select the checkbox 'Use Alternating Colors', a property for the collection view. For testing purposes I selected Red as primary color and Yellow as Secondary color. In the storyboard I immediately see the complete collection view turning Red. When I run the application my startup window shows the collection view containing all the recent documents, but all backgrounds are the primary color, which would be Red.
I did look through some tuts, also the Ray Wenderlich one, but I can't seem to find any information about the alternating colors.
This is how I create my collection view items:
- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath
{
RecentFileCollectionViewItem *item = [collectionView makeItemWithIdentifier:@"RecentFileCollectionViewItem" forIndexPath:indexPath];
NSURL *url = [self.recentFiles objectAtIndex:indexPath.item];
[item.logoImageView setImage:[NSImage imageNamed:@"NSComputer"]];
[item.fileNameLabel setStringValue:[url pathComponents][[url pathComponents].count -1]];
[item.filePathLabel setStringValue:[url path]];
return item;
}
Did anyone came across this problem? Is there a solution? Thanks a lot !