Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting TZStackView to hidden inside animateAlongsideCoordinator's animation block causes strange behavior #50

Closed
rzulkoski opened this issue Nov 1, 2015 · 1 comment

Comments

@rzulkoski
Copy link
Contributor

I have discovered a bug when attempting to set a TZStackView's hidden property during rotation. Specifically, I am attempting this inside of viewWillTransitionToSize(size:coordinator)'s coordinator.animateAlongsideTransition(animate:completion:)'s animation block.

On the first rotation everything appears to work as expected. However, on all subsequent device rotations viewWillTransitionToSize is never called. I have tracked this issue down to this block of code inside of TZStackView.swift:

 116|  if let _ = view.layer.animationKeys() {
*117|      UIView.setAnimationDelegate(self)
 118|      animationDidStopQueueEntries.insert(TZAnimationDidStopQueueEntry(view: view, hidden: hidden), atIndex: 0)
*119|      UIView.setAnimationDidStopSelector("hiddenAnimationStopped")
 120|  } else {
 121|      didFinishSettingHiddenValue(view, hidden: hidden)
 122|  }

It would seem that Apple is internally setting and relying on being the animationDelegate and setting an instance of TZStackView to the animationDelegate interferes with this. When I comment out every line except line 121 it works fine for the most part EXCEPT when animating hidden = true. This causes the view being hidden to hide immediately while the views around it properly animate to fill the empty space. I haven't gotten to the point where I understand exactly how you are orchestrating the animations yet so I'm afraid I don't have a suggestion as to how to fix the issue. Do you have any other methods at your disposal to accomplish whatever it is you are doing rather than setting yourself as the animation delegate? I'm looking forward to hearing your thoughts and I will continue to investigate the issue in the meantime.

I have uploaded a project demonstrating the bug to GitHub.

Thanks for your time and efforts.
/cheers

@rzulkoski rzulkoski changed the title Setting TZStackView to hidden inside animation block causes strange behavior Setting TZStackView to hidden inside animateAlongsideCoordinator animation block causes strange behavior Nov 2, 2015
@rzulkoski rzulkoski changed the title Setting TZStackView to hidden inside animateAlongsideCoordinator animation block causes strange behavior Setting TZStackView to hidden inside animateAlongsideCoordinator's animation block causes strange behavior Nov 2, 2015
CosynPa added a commit to CosynPa/TZStackView that referenced this issue Mar 5, 2016
…ixing tomvanzummeren#70 (Completion closure never called when animating showing/hiding) and tomvanzummeren#50 (Setting TZStackView to hidden inside animateAlongsideCoordinator's animation block causes strange behavior)
@CosynPa
Copy link

CosynPa commented Mar 5, 2016

Fixed in #72

CosynPa added a commit to CosynPa/TZStackView that referenced this issue Mar 5, 2016
…xing tomvanzummeren#70 (Completion closure never called when animating showing/hiding) and tomvanzummeren#50 (Setting TZStackView to hidden inside animateAlongsideCoordinator's animation block causes strange behavior)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants