nsscreencast / comments

Public comments on NSScreencast.com
0 stars 0 forks source link

Magic Move - NSScreencast #123

Open subdigital opened 3 years ago

subdigital commented 3 years ago

Written on 07/01/2016 03:58:28

URL: https://nsscreencast.com/episodes/172-magic-move

subdigital commented 3 years ago

originally written by Kormie on 06/06/2015 08:59:33

Hey Ben, great episode. I've implemented something similar in the past and one of the gotchas of this is handling the animation if the collection is still scrolling while it registers a tap on one of the cells. This can cause some issues with the calculation of the cell's original frame as well as gracefully handling the push animation. I'd be interested to see how/if you handle this in future versions of the code.
It also looks like you'll be handling interactive transitions in the next episode. One of the big hangups for me while learning interactive transitions was how sometimes the transition would fail to finish and cause the entire UI to turn black and become unresponsive. This was a major confusion point for me and may be something worth discussing. As always, thanks for your great work!

subdigital commented 3 years ago

originally written by subdigital on 06/06/2015 12:59:43

Good feedback. I will play around with this.

I believe I address that issue you describe in the next episode on interactive magic move.

subdigital commented 3 years ago

originally written by Korbizije on 01/24/2016 20:58:00

Hi, it seems that line that calculates snapshot.frame in animation block in Animator.swift returns a wrong frame (0,0,600,600) under 9.x (or at least 9.2). Is there any quick fix for that?

subdigital commented 3 years ago

originally written by Korbizije on 01/24/2016 21:28:45

It seems I found it, it is not enough to do just:
toVC.view.layoutIfNeeded()

instead:

toVC.view.setNeedsLayout()
toVC.view.layoutIfNeeded()

is needed.

subdigital commented 3 years ago

originally written by subdigital on 01/24/2016 21:45:28

You beat me to it! Thanks for the fix, I’ve updated the code as well as updated the project for iOS 9, Xcode 7, and Swift 2. Also fixed the constraints on the text view.

subdigital commented 3 years ago

originally written by Andrei on 03/08/2016 04:37:38

Ben,

One thing is not very clear: when transitioning from collection view to detail view, how does the snapshot ends up right below the nav bar without being covered by it? In the Animator class in animatePush method I had to replace

snapshot.frame = container.convertRect(toImageView.frame, fromView: toImageView)

line with the following three lines:

let navBarHeight = toVC.navigationController?.navigationBar.frame.size.height
let toFrame = CGRectMake(toImageView.frame.origin.x, toImageView.frame.origin.y + navBarHeight!, toImageView.frame.width, toImageView.frame.height)
snapshot.frame = container.convertRect(toFrame, fromView: toImageView)

without which the snapshot is animated all the way to (0, 0), then disappears, and the appearance of the imageView creates the jerky effect.

I guess I am missing something.

Thank you for the great series.

Andrei

subdigital commented 3 years ago

originally written by subdigital on 03/09/2016 19:22:54

Make sure you apply the fix by Korbizije below. With that I don't see any jerky movement you're talking about.

subdigital commented 3 years ago

originally written by Brian Broom on 03/28/2016 03:24:07

I wrestled with this - I had several issues where the snapshot image would end up at a different position than it should be in the detail VC (the push method). At times the snapshot ended up at the top of the screen (underneath the nav bar) and other times ended up too low. In both cases the position was off by the height of the nav bar.

I found two methods that seemed to work

1) Uncheck 'entend edges under top bars' in the detail VC

or

2) replace animatePush method with https://gist.github.com/bcb... which is commented with what I found to be problem spots. I'm not sure if these are things that changed from iOS 8 to 9, or somehow the detail VC I setup was different, or (I think most likely) I've got something messed up.

I wanted to use the effect before, but wasn't sure how to pull it off. It will be used in other ones - thank you so much for the explanation. I was always too intimidated by custom animation to give this a shot.

subdigital commented 3 years ago

originally written by subdigital on 03/28/2016 14:28:24

Thanks for the write-up Brian! This will be useful to others that run into similar problems.

subdigital commented 3 years ago

originally written by David Cespedes on 11/28/2016 17:49:55

It will be nice to have the starting point project to follow along from the begining