UIButton在动画视图后无法捕捉触摸

时间:2013-01-08 15:23:29

标签: 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);
    [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会停止捕获任何触摸。

任何提示都将受到高度赞赏。

0 个答案:

没有答案