Custom transition mimicking Apple’s native calendar and photos app. Intended to be used with collection view cells, but any view could be used.
//Import transition delegate
#import "KTZoomTransitionDelegate.h"
//create property for the transition
@property (nonatomic, strong) KTZoomTransitionDelegate *transitioningDelegate;
//Collection view method
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
//get cell’s frame in relation to view controller
UICollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
CGRect cellFrame = [collectionView convertRect:cell.frame toView:self.view];
//create desired view controller for next screen
UIViewController *vc = (UIViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"second vc"];
//init the custom transition with the cell frame
self.transitioningDelegate = [[KTZoomTransitionDelegate alloc] initWithRect:cellFrame];
vc.transitioningDelegate = self.transitioningDelegate;
//present vc
[self presentViewController:vc animated:YES completion:nil];
}
Contact above.
KTCollectionViewZoomTransition is available under the MIT license. See license file for more info.