IOS8 Text in TextField Bounces on Focus

2019-07-12 03:44发布

问题:

There is a weird bug where I switch to a screen in my app. This causes the first textfield to become first responder and the cursor is inside the textfield. Then type some text into the field and switch focus to the next textfield, this causes the text in the first box to bounce up and come back down. This happens only on the first time of coming to the screen in question. In order to replicate I need to back out of the screen and go back to it. Any ideas what would cause the text to bounce when focus is lost for the first time? Why would text field text bounce in general?

回答1:

adding

[textField layoutIfNeeded];

to start of textFieldDidEndEditing: fixed the issue. Any ideas why?