Skip to content

Instantly share code, notes, and snippets.

@veader
Created April 12, 2011 03:19
Show Gist options
  • Save veader/914853 to your computer and use it in GitHub Desktop.
Save veader/914853 to your computer and use it in GitHub Desktop.
// Using an animation grouping because we may be changing the duration
[NSAnimationContext beginGrouping];
// With the shift key down, do slow-mo animation
if ([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) {
[[NSAnimationContext currentContext] setDuration:1.0];
} else {
[[NSAnimationContext currentContext] setDuration:0.6];
}
NSRect originalFrame;
NSRect finalFrame;
// set final frame (ie: move to left by width)
originalFrame = _mainFeedViewController.view.frame;
finalFrame = originalFrame;
finalFrame.origin.x += originalFrame.size.width;
[_mainFeedViewController.view.animator setFrame:finalFrame];
originalFrame = _detailViewController.view.frame;
finalFrame = originalFrame;
finalFrame.origin.x += originalFrame.size.width;
[_detailViewController.view.animator setFrame:finalFrame];
[NSAnimationContext endGrouping];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment