UITextField Strange Behaviour When Entering Text

冷暖自知 提交于 2019-12-07 15:04:57

问题


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

Then I Entered Again single character G using iOS Keyboard

Again single character G using iOS Keyboard

Again single character G using iOS Keyboard

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


回答1:


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.




回答2:


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.




回答3:


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.

   




回答4:


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

taken from here:

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



来源:https://stackoverflow.com/questions/22631235/uitextfield-strange-behaviour-when-entering-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!