0
我得到了我沒寫但需要修復的代碼。視圖開始時需要播放動畫序列。這段代碼在iOS 6中完美運行,但升級到iOS 8後,動畫序列不再有效。也許你可以幫我找到什麼是錯的,爲什麼它可以在6,但不能在8動畫序列不再適用於iOS 8
- (void)viewDidLoad
{
//bla bla stuff
[self initiateImageSequence];
//bla bla more stuff
}
- (void)initiateImageSequence
{
dispatch_queue_t backgroundQueue = dispatch_queue_create("initiate", 0);
dispatch_async(backgroundQueue, ^{
[self.mainImageView setAnimationImages:self.zoom.imageSequenceArray];
[self.mainImageView setImage:[self.zoom.imageSequenceArray lastObject]];
dispatch_async(dispatch_get_main_queue(), ^{
// Update UI
[self.mainImageView setAnimationDuration:1.0];
[self.mainImageView setAnimationRepeatCount:1];
[self.mainImageView startAnimating];
[self showMainLayer];
[self performSelector:@selector(didReceiveMemoryWarningInSite) withObject:nil afterDelay:1.0];
});
});
}
目前發生了什麼?你期望發生什麼?你已經做了什麼來診斷它? – 2014-10-12 13:43:01
目前沒有任何反應,我看到的是動畫後會發生什麼,應該發生的動畫序列應該播放。我所做的診斷是檢查圖像數組是否已滿,並且沒問題,還有使用NSLog進行打印檢查,看起來代碼運行良好。 – Dim 2014-10-12 13:52:30
可能不是它,但我發現最好始終在主隊列上做UI動畫,更改等,否則會發生奇怪的事情。我會在背景隊列中完成所有加載,然後在動畫時啓動到主要。我還建議使用'dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND,0)' 而不是創建你自己的。 – BooRanger 2014-12-10 14:59:13