Bird
0
0

You want to create a layout where an image is behind two vertically stacked texts. Which stack combination is correct?

hard📝 Application Q8 of 15
iOS Swift - SwiftUI Basics
You want to create a layout where an image is behind two vertically stacked texts. Which stack combination is correct?
AVStack { Image() HStack { Text() Text() } }
BZStack { Image() VStack { Text() Text() } }
CHStack { Image() VStack { Text() Text() } }
DZStack { VStack { Text() Text() } Image() }
Step-by-Step Solution
Solution:
  1. Step 1: Understand layering with ZStack

    ZStack overlays views; first view is bottom layer.
  2. Step 2: Arrange image behind texts

    Place Image first, then VStack with texts inside ZStack.
  3. Final Answer:

    ZStack { Image() VStack { Text() Text() } } -> Option B
  4. Quick Check:

    Image behind texts = ZStack with Image first [OK]
Quick Trick: Put background first in ZStack, foreground after [OK]
Common Mistakes:
  • Placing Image after texts in ZStack
  • Using HStack instead of VStack for vertical texts
  • Confusing order of views in ZStack

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More iOS Swift Quizzes