I am developing a Cocoa application and want me to be able to click on a button in one of the views in my NSCollectionView and open the details view and put it in the middle of the screen, like in iPhoto 09 when you click βiβ in the lower right corner of the photo. The photo flips and grows in the center of the window to show details about the photo.
I guess they use Core Animation to achieve this. I watched the Lemur Flip example, but when I try to modify it to add repositioning of the code to the animation, it resets the flip.
Here is the positioning code that I added to the sender - (IBAction) flip: (id); LemurFlip Code:
...
[CATransaction begin]; {
NSSize supersize = contentView.frame.size;
NSSize subsize = frontView.frame.size;
if(!frontView.isHidden)
{
[[backView animator] setFrameOrigin:NSMakePoint((supersize.width / 2) - (subsize.width / 2), (supersize.height / 2) - (subsize.height / 2))];
[[frontView animator] setFrameOrigin:NSMakePoint((supersize.width / 2) - (subsize.width / 2), (supersize.height / 2) - (subsize.height / 2))];
}
else {
[[backView animator] setFrameOrigin:NSMakePoint(0, 0)];
[[frontView animator] setFrameOrigin:NSMakePoint(0, 0)];
}
[hiddenLayer addAnimation:[self _flipAnimationWithDuration:flipDuration isFront:NO] forKey:@"flipGroup"];
[visibleLayer addAnimation:[self _flipAnimationWithDuration:flipDuration isFront:YES] forKey:@"flipGroup"];
} [CATransaction commit];
...
, - ?