Skip to content

Instantly share code, notes, and snippets.

@joehoyle
Created October 12, 2010 17:48
Show Gist options
  • Save joehoyle/622600 to your computer and use it in GitHub Desktop.
Save joehoyle/622600 to your computer and use it in GitHub Desktop.
- (void)showActiveView
{
var centerX = [[[CPApp mainWindow] contentView] frame].size.width / 2;
var centerY = [[[CPApp mainWindow] contentView] frame].size.height / 2;
var frameTo = [activeView frame];
frameTo.origin.x = centerX - ( frameTo.size.width / 2 );
frameTo.origin.y = centerY - ( frameTo.size.height / 2 );
var frameFrom = CGRectMakeCopy( frameTo );
if( !isShowingView ) {
frameFrom.size.width = (frameFrom.size.width / 1.1);
frameFrom.size.height = (frameFrom.size.height / 1.1);
} else {
frameFrom.origin.x = frameFrom.origin.x + 20;
frameFrom.origin.y = frameFrom.origin.y + 20;
}
[activeView setBackgroundColor:[CPColor whiteColor]];
[activeView setAlphaValue:0];
//show the view
[activeView setFrame:frameFrom];
[activeView makeCenterOfSuperview];
if( !isShowingView ) {
[[[CPApp mainWindow] contentView] addSubview:activeView];
[[[CPApp mainWindow] contentView] addSubview:overlayView];
} else {
[[[CPApp mainWindow] contentView] addSubview:activeView];
}
if( !isShowingView ) {
[overlayView setAlphaValue:0.7 animate:YES duration:.4];
}
[activeView setFrame:frameTo animate:YES duration:.15];
[activeView setAlphaValue:1 animate:YES duration:.2];
isShowingView = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment