a category on NSView that simplifies zoom-transitioning between two NSViews, inspired by OS X 10.10.3's Photos.app (Blog Post)
- You can use the code in your own products.
- You can modify the code as you wish, and use the modified code in your products.
- You can redistribute the original, unmodified code, but you have to include the full license text below.
- You can redistribute the modified code as you wish (without the full license text below).
- In all cases, you must include a credit mentioning Matthias Gansrigler as the original author of the source.
- I’m not liable for anything you do with the code, no matter what. So be sensible.
- You can’t use my name or other marks to promote your products based on the code.
- If you agree to all of that, go ahead and download the source. Otherwise, don’t.
You’ll have to first add the NSView+ESSViewCategory.h and *.m files to your project. Please note that the category imports <Quartz/Quartz.h> for Core Animation’s CAMediaTiming class, so you might have to add that framework to your project, too.
fromView It has to be inside of a view hierarchy. Fades out during the transition.
toView Can be in a different xib file (for example, a NSViewController) or in the same as fromView. It’s important that it is not already on screen somewhere. Fades in during the transition.
Once you have set up your views, either call the class method and pass fromView and toView as well as the other parameters or call the instance method on fromView.
The class method:
+ (void)transitionFromView:(NSView *)fromView toView:(NSView *)toView withZoomingTransition:(ESSViewZoomTransition)transition duration:(CGFloat)duration completionHandler:(void (^)(void))completionHandler;
The instance method:
- (void)transitionToView:(NSView *)toView withZoomingTransition:(ESSViewZoomTransition)transition duration:(CGFloat)duration completionHandler:(void (^)(void))completionHandler;
Please refer to the sample project and/or the (Blog Post) for more information.
This code has been tested on OS X Yosemite 10.10.3. It might work with earlier versions of the operating system.
Developed with Xcode 6.3.1
The framework and code is provided as-is, but if you need help or have suggestions, you can contact me anytime at [email protected] or @eternalstorms on twitter
For other Open Source projects of mine, please visit http://www.eternalstorms.at/opensource
If you use NSView+ESSViewCategory in one of your projects, please be sure to let me know! I'd love to hear about your apps and mention them here on this project page :) !!