我試着在這裏查看至少半打問題,我似乎無法弄清楚如何正確預加載圖像。第一次運行總是滯後於每個動畫,直到我失去了25%的幀。這不是最引人注目的事情,但它絕對是明顯的。之後,當他們已經加載它不再口吃了。它們是相對較短的動畫,沒有一個超過20個PNG。在xcode的第一次運行動畫口吃
我的圖像陣列是
{
Stickman.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"DAL1.png"],
[UIImage imageNamed:@"DAL2.png"],
[UIImage imageNamed:@"DAL3.png"],
[UIImage imageNamed:@"DAL4.png"],
[UIImage imageNamed:@"DAL5.png"],
[UIImage imageNamed:@"DAL6.png"],
[UIImage imageNamed:@"DAL7.png"],
[UIImage imageNamed:@"DAL8.png"],
[UIImage imageNamed:@"DAL9.png"],
[UIImage imageNamed:@"DAL11.png"],
[UIImage imageNamed:@"DAL11.png"],
[UIImage imageNamed:@"DAL12.png"],
[UIImage imageNamed:@"DAL13.png"],
[UIImage imageNamed:@"DAL14.png"],
[UIImage imageNamed:@"DAL15.png"],
[UIImage imageNamed:@"DAL16.png"],
[UIImage imageNamed:@"DAL17.png"],
[UIImage imageNamed:@"DAL18.png"],
[UIImage imageNamed:@"DAL19.png"],
[UIImage imageNamed:@"DAL20.png"],
nil];
[Stickman setAnimationRepeatCount:1];
Stickman.animationDuration = 1.52;
[Stickman startAnimating];
}
起初我還以爲是模擬器的滯後性,但是當我嘗試過了一個真正的設備上它仍然有同樣的問題。
你能以「播種」的動畫引擎,包括空白圖像的一個動畫解決呢? – matt
另外,如果您在非常短的時間(例如'0.1')GCD延遲中調用'startAnimating',它有什麼區別嗎? – matt