Bird
0
0

Given this code snippet, what is the visible effect?

medium📝 Predict Output Q5 of 15
iOS Swift - Animations
Given this code snippet, what is the visible effect?
let transition = CATransition()
transition.type = .moveIn
transition.subtype = .fromTop
transition.duration = 1.0
view.layer.add(transition, forKey: kCATransition)
view.alpha = 0.5
AThe view fades to half transparency without movement
BThe view slides out to the top
CThe view moves in from the top while changing transparency
DNo visible change occurs
Step-by-Step Solution
Solution:
  1. Step 1: Understand transition type and subtype

    Type is moveIn, subtype fromTop, so new content moves in from top.
  2. Step 2: Recognize alpha change triggers animation

    Changing alpha triggers the transition, so view moves in from top while becoming half transparent.
  3. Final Answer:

    The view moves in from the top while changing transparency -> Option C
  4. Quick Check:

    moveIn + fromTop = move in from top [OK]
Quick Trick: moveIn slides new content over old from direction [OK]
Common Mistakes:
  • Ignoring alpha change effect
  • Confusing moveIn with slide out
  • Expecting no animation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes