2012-11-20 68 views
-2

我的程序有UIToolBar,其中包含UITextFieldUIButton。當軟鍵盤出現時,整個視圖(self.view)就會出現。當UIToolBar移動到新的位置時,該按鈕有時不會正確捕獲事件。點擊按鈕需要點擊一個事件。動畫UIButton不願意捕捉事件

當鍵盤出現

[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]; 
+0

的[詞在iPhone屏幕上方落下](HTTP可能重複執行下面的代碼集:// stackoverflow.com/questions/8222466/words-falling-from-the-top-of-screen-in-iphone) - 請參閱我的答案,關於presentationLayer和touch物件的動畫處理 – jrturton

回答

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) {}]; 
+0

仍然不起作用。一旦動畫完成,它需要點擊幾下。按鈕的某些部分根本沒有響應。 –