Skip to content

Instantly share code, notes, and snippets.

@nickjs
Created September 25, 2008 18:48
Show Gist options
  • Save nickjs/12895 to your computer and use it in GitHub Desktop.
Save nickjs/12895 to your computer and use it in GitHub Desktop.
@implementation LEStack : CPView
{
CPDictionary collection;
CPCollectionView grid;
}
- (LEStack)initWithOrigin:(CGPoint)aPoint
{
self = [super initWithFrame:CGRectMake(0,0,500,500)];
[self setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[self setHidden:YES];
grid = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()];
[grid setDelegate:self];
[grid setMinItemSize:CGSizeMake(150,150)];
[grid setMaxItemSize:CGSizeMake(150,150)];
[self addSubview:grid];
return self;
}
}
- (void)setCollection:(CPDictionary)aDict
{
var item = [[CPCollectionViewItem alloc] init];
[item setView:[[LEStackItem alloc] initWithFrame:CGRectMake(0,0,150,150)]];
[grid setItemPrototype:item];
[grid setContent:[[aDict allValues] copy]];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment