相关疑难解决方法(0)

在eventFirstResponder或resignFirstResponder的情况下,将对象保持在键盘顶部?

我目前在键盘上有一个UITextField.点击它时,它应该粘在键盘顶部并平稳向上移动.我不知道键盘的确切持续时间和动画类型,所以它真的很颠簸.这就是我所拥有的:

[theTextView resignFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.25];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
// Frame changes go here (move down 216px)
[UIView commitAnimations];

[theTextView becomeFirstResponder];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.25];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
// Frame changes go here (move up 216px)
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

如果有人之前做过这样的事情,我想知道你用来使动画变得平滑的设置,并让它看起来像是"卡在"键盘的顶部.

iphone objective-c uitextfield becomefirstresponder resignfirstresponder

13
推荐指数
2
解决办法
7672
查看次数