6

I think that my question is related to thread. I have a login screen with two UITextFields (user/pass). Both are horizontally center aligned with placeholder text. When I press a field, the placeholder text jumps a bit to the left and the marker is positioned after the first character (which looks awful).

Text field in focus.

When I start typing, the clear button appears (as it should) but the text is not correctly centered in the UITextField view.

Textfield with text

The problem only occurs when a text field has first responder.

How can I make the darn text and placeholder text stay in the center of the text field???

UPDATE: Text field settings in Storyboard:

Text field settings in Storyboard

Community
  • 1
  • 1
Chuckels5584
  • 551
  • 2
  • 6
  • 17

2 Answers2

0

I had the same problem and what I did is that I've created my custom control that has UITextField above and UILabel below both controls has the same width and height. When I need to display text placeholder I set label alpha to 1 and when I need to hide placeholder I set alpha to 0. Also I set text inoput bg color to clear color. In addition to do all of this I implement UITextFieldDelegate (textFieldDidBeginEditing/ textFieldDidEndEditing/ shouldChangeCharactersInRange)

zvjerka24
  • 1,772
  • 1
  • 21
  • 27
-1

Please see the control alignment in the below image and set accordingly. It will solve your problementer image description here

Karlos
  • 1,653
  • 18
  • 36