问题
Below is a demonstration of how the text in my text field is moving when the text field is active. By applying a background to the field, i found that only the text moves, not the whole text field itself. This is not happening to the text field above as well, only the bottom one
回答1:
after search for this issue i recommend to change your font to another font. but there is some way to prevent this issue :
you can use this :
- (void)textFieldDidEndEditing:(UITextField *)textField
{
[textField layoutIfNeeded]; //Fixes iOS 9 text bounce glitch
//...other stuff
}
please check this links :
Text in UITextField moves up after editing (center while editing)
UITextField text jumps iOS 9
回答2:
Try to change to font to Arial, helped me.
yourTextField.font = UIFont(name: "Arial", size: CGFloat(16))
来源:https://stackoverflow.com/questions/35680996/uitextfield-text-moving-unexpectedly