Skip to content

Instantly share code, notes, and snippets.

@j4johnfox
Created November 21, 2008 00:00
Show Gist options
  • Save j4johnfox/27286 to your computer and use it in GitHub Desktop.
Save j4johnfox/27286 to your computer and use it in GitHub Desktop.
- (id)init
{
self = [self initWithContentRect:CGRectMake(0.0, 0.0, 500.0, 165.0) styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
if (self)
{
[self setTitle:@"Photos"];
[self setFloatingPanel:YES];
[self setMinSize:CGSizeMake(300.0, 170.0)];
[self setMaxSize:CGSizeMake(800.0, 170.0)];
var contentView = [self contentView],
bounds = [contentView bounds];
bounds.size.height -= 20.0;
bounds.size.width = 3000;
photosView = [[CPCollectionView alloc] initWithFrame:bounds];
[photosView setAutoresizingMask:CPViewWidthSizable];
[photosView setMinItemSize:CGSizeMake(100, 100)];
[photosView setMaxItemSize:CGSizeMake(100, 100)];
[photosView setDelegate:self];
[photosView setMaxNumberOfRows:1];
[photosView setMaxNumberOfColumns:0];
log('[photosView maxNumberOfRows] is ' +[photosView maxNumberOfRows]);
var itemPrototype = [[CPCollectionViewItem alloc] init];
[itemPrototype setView:[[PhotoView alloc] initWithFrame:CGRectMakeZero()]];
[photosView setItemPrototype:itemPrototype];
var scrollView = [[CPScrollView alloc] initWithFrame:bounds];
[scrollView setDocumentView:photosView];
// | CPViewHeightSizable
[scrollView setAutoresizingMask:CPViewWidthSizable];
[scrollView setAutohidesScrollers:YES];
[[scrollView contentView] setBackgroundColor:[CPColor whiteColor]];
[contentView addSubview:scrollView];
[self setImages:[]];
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment