0

I have 2 views in stack view. The spacing value is -15, because I want the second view be under the first view with -15 spacing.
The spacing is ok but the first view is under the second one.
I tried setting the first view zPosition, but it didn't work.

firstViewlayer.zPosition = 1;
Fattaneh Talebi
  • 727
  • 1
  • 16
  • 42

1 Answers1

1

There are several options.

  1. you could ask the stackview to bring the coresponding view to front. stackview.bringSubviewToFront(firstView) https://developer.apple.com/documentation/uikit/uiview/1622541-bringsubviewtofront
  2. or you add them completely manually. Fist add the as subviews. (the fist view last in this case) and the add them as addArrangedSubview (the fist view fist in this case)

But bringSubviewToFront is probably the fastest way

Helge Becker
  • 3,219
  • 1
  • 20
  • 33