Skip to content

Instantly share code, notes, and snippets.

@boucher
Created March 12, 2010 19:10
Show Gist options
  • Save boucher/330641 to your computer and use it in GitHub Desktop.
Save boucher/330641 to your computer and use it in GitHub Desktop.
@implementation AvailableSceneView : CPImageView
{
}
- (void)setRepresentedObject:(id)anObject
{
[self setImage:anObject];
}
@end
////// OR
@implementation CPControl (CollectionView)
- (void)setRepresentedObject:(id)anObject
{
[self setObjectValue:anObject];
}
@end
- somewhere
{
item = [[CPCollectionViewItem alloc] init];
[item setView:[[AvailableSceneView alloc] init]];
//etc.
[collectionView setDelegate:self];
[collectionView setItemPrototype:item];
}
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView
{
//grab the new selected index, do something with it
}
- (void)collectionView:(CPCollectionView)aCollectionView dragTypesForItemsAtIndexes:(CPIndexSet)indexes
{
//return drag types
}
- (void)collectionView:(CPCollectionView)aCollectionView dataForItemsAtIndexes:(CPIndexSet)indexes forType:(CPString)aType
{
//return the data of this type at this index
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment