2012-09-25 34 views
0

我有這樣的代碼:的動畫預防的touchesBegan

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event 
{ 
    MainGame *newview = [[MainGame alloc] initWithNibName:@"MainGame" bundle:nil]; 
    newview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    [self presentModalViewController:newview animated:YES]; 
} 

它是用來切換到一個名爲MainGame當我觸摸屏幕但有時當我觸摸屏幕沒有任何反應視圖。

我想說的是,我的touchesBegan只是有時會接觸到觸摸,其他時候它只會被忽略。

沿着側此代碼我也具有約1 - 4的UIView動畫運行其通過設置:

[UIView的animateWithDuration:...];

但是,如果我刪除動畫,它將始終識別touchesBegan。

那麼,爲什麼我的動畫停止觸摸開始被識別,我怎麼能阻止這種情況發生?

回答

1

使用的UIView方法:

animateWithDuration:delay:options:animations:completion: 

,並設置選項:

UIViewAnimationOptionAllowUserInteraction 

這應該爲你做它。

+0

謝謝!現在工作正常。當Stackoverflow允許我將標記爲正確的答案。 – CHRIS