Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In my app I used a similar effect to zoom in from a thumbnail in a collection view cell to a child view controller that took up the entire screen. You could conceivably do the same thing for a navigation controller push as well.</p> <p>In my code, I had a <code>scoreView</code> property on the cell subclass that I wanted to zoom up into the full screen. In your case, you may want to use a <code>UIImageView</code> with a screenshot of your new view. Alternatively, you could present the new view controller with a screenshot of the old view controller and then animate from there.</p> <pre><code>//Instantiate the view controller to be animated in... //If the cell is not completely inside the collection view's frame, a dissolve animation might be more graceful. BOOL dissolveAnimation = !CGRectContainsRect(CGRectMake(0, 0, self.collectionView.frame.size.width, self.collectionView.frame.size.height), cellRect); //Get the frame of the cell in self.view coordinates, then the frame of the thumbnail view CGRect cellRect = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath].frame; cellRect = CGRectOffset(cellRect, 0.0, -self.collectionView.contentOffset.y); VSScoreCell *scoreCell = (VSScoreCell *)[self.collectionView cellForItemAtIndexPath:indexPath]; CGRect scoreRect = dissolveAnimation ? CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height) : CGRectMake(cellRect.origin.x + scoreCell.scoreView.frame.origin.x, cellRect.origin.y + scoreCell.scoreView.frame.origin.y, scoreCell.scoreView.frame.size.width, scoreCell.scoreView.frame.size.height); VSScoreView *scoreView = [[VSScoreView alloc] initWithFrame:scoreRect]; //Initialize the view that will be animated up (in this case scoreView)... if (dissolveAnimation) scoreView.alpha = 0.0; [self.view addSubview:scoreView]; [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ if (dissolveAnimation) scoreView.alpha = 1.0; else scoreView.frame = CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height); } completion:^(BOOL finished) { if (finished) { //Add scoreDisplayController as a child view controller or present it without animation [scoreView removeFromSuperview]; } }]; </code></pre> <p>Of course, the new iOS might make this easier (my lips are sealed), but I hope this is somewhat helpful for your situation!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload