Text Fields don't appear in stack view?

I am using Xcode 11 for a macOS app. When I add a text field(s) to a window and then test, the text field shows up. However when I selected the text field(s) and use the "embed in" button for a stack view they no longer show up.

I have even tried this on a test project with one label and one text field and the same thing happens.

I must be missing something? Why does this occur?


Answered by Claude31 in 630245022
For the textField in StackView, you need to set width (height not needed for a vertical stack) constraints for the TextField.
If 2 textFields embedded, setting just for ones enough.

It seems otherwise, the width of all is zero, thus invisible.

Then it shows correctly when running.
Another unexpected occurrence .. I added a popup button to the stack view with the text field and then they all show up, but the width of the fields is locked as well as truncated. I trying something that just does not work the way I am thinking?
Accepted Answer
For the textField in StackView, you need to set width (height not needed for a vertical stack) constraints for the TextField.
If 2 textFields embedded, setting just for ones enough.

It seems otherwise, the width of all is zero, thus invisible.

Then it shows correctly when running.
Yes, that took care of it. However I did have to add width constraints to the other text fields as well to get the desired with. With just one constraint set it used this value for the other text fields.

Text Fields don't appear in stack view?
 
 
Q