Link for previous question: UITextField text jumps
Briefly:
I have ViewController with 2 UITextField elements. When loginField is firstResp
I've faced same issue, when I was trying to change first responder. There is a better solution for this issue. Just implement UITextField subclass and used in places, where your text field can be animated (keyboard, first respond switching and so on).
@interface UITextFieldFixed : UITextField
@end
@implementation UITextFieldFixed
- (BOOL)resignFirstResponder
{
BOOL result = [super resignFirstResponder];
[self setNeedsLayout];
[self layoutIfNeeded];
return result;
}
@end
More info about issue: https://github.com/foundry/UITextFieldBug
Copy and paste for Swift3...
class UITextFieldFixed: UITextField {
override func resignFirstResponder() -> Bool {
let r = super.resignFirstResponder()
self.setNeedsLayout()
self.layoutIfNeeded()
return r
}
}