UITextField text disappears on every other keystroke UITextField text disappears on every other keystroke xcode xcode

UITextField text disappears on every other keystroke


I had almost the same problem. Sometimes the text was disappearing.

I solved it after changing the position of the UITextField in the view hierarchy in the xib file.

enter image description here


I was facing the same problem. My solution was to remove [_textField becomeFirstResponder] from the - (void)viewWillAppear:(BOOL)animated method. This bug only occurs if the viewcontroller was presented modally.


Moving the UITextField's becomeFirstResponder from viewWillAppear to viewWillLayoutSubviews fixed this for my case. I also made sure to add resignFirstResponder on the UITextField to the actions that were dismissing the view (which was presented modally).