我正在使用下一个代码淡出并向上滚动我的文本字段,但我只是注意到,当我使用类似 [textField setText:@"something"];
或 [textField resignFirstResponder];
我失去了向上滚动。任何人都愿意解释为什么我会出现这种行为以及可能的解决方法。
[UIView animateWithDuration:0.5
delay:0.0
options:UIViewAnimationCurveEaseInOut
animations:^ {
CGRect Frame = textField.frame;
Frame.origin.y=100;
textField.frame=Frame;
textField.alpha = 0.0;
}
completion:^(BOOL finished) {
textField.hidden = YES;
}];
[textField resignFirstResponder];
}
最佳答案
您应该将 [textField resignFirstResponder];
放入完成 block 中。
关于ios - setText 时不能使用 Frame.origin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13850786/