Ios UIButton在设置视图动画后不捕捉触摸
在我的程序中,我使用以下代码设置self.view的动画,因为软键盘覆盖了页面底部的UITextFieldIos UIButton在设置视图动画后不捕捉触摸,ios,animation,uibutton,Ios,Animation,Uibutton,在我的程序中,我使用以下代码设置self.view的动画,因为软键盘覆盖了页面底部的UITextField - (IBAction)moveViewUp:(UITextField *)textField { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.25]; self.view.frame = CGRectMake(0,-150,320,400); [UIVi
- (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停止捕捉任何触摸
任何提示都将不胜感激。当类似的事情发生在我身上时,总是因为我已设法将我的按钮移到视图框架之外,并且我没有剪切到边界,所以我仍然可以看到按钮,但无法点击它。尝试更改视图的背景色,以确保它仍然位于框架内。按钮包含在哪个视图中?自我观点?似乎一定是发生了其他事情,而不是在给定的代码中,导致了这个问题。您解决了这个问题吗?我也有同样的问题