-2

我的程序有 aUIToolBar其中包含 aUITextField和 a UIButton。当软键盘出现时,整个视图 ( self.view) 就会出现。当UIToolBar移动到新位置时,按钮有时无法正确捕获事件。需要多次单击按钮才能触发单个事件。

下面这组代码在键盘出现时执行

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
self.view.frame = CGRectMake(0,-220,320,400);
tableView.frame = CGRectMake(10, 220, 320, 264);
[UIView commitAnimations];
4

1 回答 1

0

尝试这个

[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
    self.view.frame = CGRectMake(0,-220,320,400);
    tableView.frame = CGRectMake(10, 220, 320, 264);
}completion:^(BOOL finished) {}];
于 2012-11-20T22:24:12.323 回答