Answer the question
In order to leave comments, you need to log in
How to center a textbox in Xcode?
I watch lessons on layout in ios development. Everything seems to be clear. I tried to do a simple thing myself - add a text input field 300 pt wide, centered at a certain distance from the top. Does not work.
Here's what we have:
Constraints:
- top 351 pt
- center of the text box in the center of the Safe Area
- margin width - 300 pt
In my opinion, it's as simple and clear as possible. But on the preview, the field shrinks to a square, ignoring the width.
What's wrong?
Answer the question
In order to leave comments, you need to log in
Well, where is your width limit? In the screenshot, I see only two.
top = safeArea.top + 351
centerX = safeArea.centerX
width = 300
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question