在我的程序中,我使用以下代码为self.view设置动画,因为软键盘覆盖了页面底部的UITextField。
- (IBAction)moveViewUp:(UITextField *)textField
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
self.view.frame = CGRectMake(0,-150,320,400);
[UIView commitAnimations];
}
以下代码将视图恢复到原始位置。
- (IBAction)moveViewDown:(UITextField *)textField
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
self.view.frame = CGRectMake(0,0,320,400);
[UIView commitAnimations];
}
但是一旦两种方法都被执行,屏幕看起来很正常,屏幕上的UIButton会停止捕获任何触摸。
任何提示都将受到高度赞赏。