A
A
Andrey2019-10-23 18:16:40
iOS
Andrey, 2019-10-23 18:16:40

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:
5db06ec6e3c8e976080197.png
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

1 answer(s)
D
doublench21, 2019-10-23
@f-end

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 question

Ask a Question

731 491 924 answers to any question