Beginning iOS Animations · Challenge: Triggering View Transitions | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9051-beginning-ios-animations/lessons/10

@catie and @jessycatterwaul, first, I’m really enjoying this course!
While I understood how to achieve the correct result for this challenge, what I couldn’t figure out was what would be the container view, or what exactly was being hidden - given that the slider code has been provided for us. I’m not sure how this slider makes it into our app in the first place since it is not visible in the storyboard.
Using the ‘Debug View Hierarchy’ option in xCode, I can see that the tableview hides the slider. But even in this debug view, I cannot seem to determine the superview of the slider, or that the slider makes use of ‘isHidden’. As mentioned, in the Debug View Hierarchy, it simply looks like this slider is behind the tableview and not necessarily ‘hidden’.
How might I have gone about identifying these things?

Hello again!

First of all, I apologize for the confusion here with the word “hidden”. You have it correct that the slider is not visible (“hidden”) because it is behind the tableview, and not because it is hidden via its isHidden property. We’re merely using the isHidden property to trigger the transition. We don’t actually need to use isHidden to hide the slider.

Hopefully based on my answer to your question from Episode 2, you understand how the slider makes its way into the app!

The container view should be the superview of whatever view you want to apply the view transition to. You can access any view’s superview via its superview property, just like we did in this challenge. But hopefully, you also now know that the slider is added as a subview of titleLabel’s superview in the makeSlider method. If you check Main.storyboard, you’ll see titleLabel’s superview is Menu View.

I realize that probably seems convoluted, and I think we could have avoided a lot of confusion simply by making an outlet for Menu View. I’ll see about getting that into the next update.

Hi @catie, again, thanks for taking the time to explain. So just to clarify with a followup question: the slider is not being hidden by means of the isHidden property. Yet, we can still use isHidden to trigger the transition? I don’t think I am following how we can trigger the transition using the isHidden property if it is not being used. Sorry, I’m probably missing something really obvious. :stuck_out_tongue_closed_eyes:

Oh! I’m sorry, I implied something in my response that isn’t true. Let me try to clarify!

In the animations closure we are definitely hiding the slider via isHidden, and isHidden is triggering the view transition. But then we are immediately un-hiding the slider in the completion closure.

So, most of the time that you are looking at the app, the slider’s isHidden property is set to false. It is only set to true for the brief time it takes for the view transition to complete.

Ah, thank you! Makes sense!