Buntylm
Buntylm

Reputation: 7363

UITextField Strange Behaviour When Entering Text

Want to Search this Issue on Google But Do't Know What i need to write for find the exact reason So i am here.

ISSUE Create UITextField using Interface Builder and Run the project and while i am entering any value using iOS Keyboard this is what happening and i am confuse.

This Happened in One Project and as i created new one everything working fine.

Very First Time When App Started on Simulator.

Then I Entered single character G using iOS Keyboard

enter image description here

Then I Entered Again single character G using iOS Keyboard

enter image description here

Again single character G using iOS Keyboard

enter image description here

Again single character G using iOS Keyboard

enter image description here

what is the up down up down going here its totally strange but facing this problem.

You can review the Youtube Video

Please if anyone know about it share.

thanks

Upvotes: 3

Views: 241

Answers (4)

Werner Kratochwil
Werner Kratochwil

Reputation: 382

Maybe the solution is this: func textFieldDidEndEditing(textField: UITextField) { textField.layoutIfNeeded() }

taken from here:

Text in UITextField moves up after editing (center while editing)

Upvotes: 1

Igor
Igor

Reputation: 12303

In my case it was when UITextField was added as first element of UI. I worked with StoryBoard, so I put another element (UIButton) to first position and problem disappeared.

enter image description here     enter image description here

Upvotes: 1

Gougou
Gougou

Reputation: 387

Same problem just arrived here, and I reached this post via Google. In my case, the UITextField was added in a xib, in a view controller presented modally, and I needed the navigationbar to remain translucent.

So the only workaround I found was to remove the outlet from XIB, and add it programmatically in viewDidLoad method.

That did the trick.

Upvotes: 1

Razmog
Razmog

Reputation: 91

I had the exact same issue. Didn't have this in a previous release of my app 2 weeks ago.

I've found that the issue is coming from presenting a view controller embedded in a navigation controller with a translucent navigation bar.

I set opaque bar in the simulated metrics of the navigation controller I was presenting and no more issue with UITextField.

On my case at least, everything were resolved at the moment I set opaque bar for top bar in simulated metrics in InterfaceBuilder for my UINavigationController which embed a UIViewController I've wanted to present modally

Hope it will be the same for you as well.

Upvotes: 2

Related Questions