When is a view drawn in chapter 26

The code goes
hudView.show(animated: animated)

Does this mean adding the hudView to view does not draw it yet? Because I did not notice it go from scale 1 to 1.3 to 1. It started out at 1.3.

If you comment out hudView.show(…, you will see that the view gets drawn shortly after it is added. But it is not immediate, so the call to hudView.show will get the animation in place before you see anything.

The show method first sets the starting properties, with alpha = 0 and scale = 1.3. The animation block then animates them to the final properties, alpha = 1 and scale = 1.

Then, as the book says,

The HUD view will quickly fade in as it goes from fully transparent to fully opaque, and it will scale down from 1.3 times its original size to its regular width and height.

This topic was automatically closed after 166 days. New replies are no longer allowed.