-
Notifications
You must be signed in to change notification settings - Fork 126
Description
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