2011-09-19 51 views
2

我們的iPad應用程序有一個主要的UIViewController視圖,它包含了與他們自己的任務的頂部幾個子視圖,它們包含uitableviews,圖像庫,圖形和代碼。我們還確保每個子視圖都是自己的控制器類來管理動畫和用戶交互。同步動畫互相阻止

問題是,動畫互相阻塞,每次我們與tableView,股票行情和畫廊(其中也有自動動畫)凍結交互。

我們可以嘗試什麼方法同時進行動畫? 我們是否應該嘗試直接在覈心動畫中使用圖層或在同一個動畫塊中執行所有動畫?

謝謝。

回答

1

下面是一些有用的代碼:

// We schedule a timer for a desired 30fps animation rate. 
// In performAnimation: we determine exactly 
// how much time has elapsed and animate accordingly. 
timer = [[NSTimer scheduledTimerWithTimeInterval:(1.0/30.0) target:self selector:@selector(performAnimation:) userInfo:nil repeats:YES] retain]; 

// The next two lines make sure that animation will continue to occur 
// while modal panels are displayed and while event tracking is taking 
// place (for example, while a slider is being dragged). 
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSModalPanelRunLoopMode]; 
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];