2010-07-20 24 views
0

我有這真的只是代碼:iPhone - performSelectorOnMainThread:@selector(setNeedsDisplay)在iOS 4上不起作用?

myPageRef = CGPDFDocumentGetPage(myDocumentRef,CGPDFPageGetPageNumber(myPageRef)+1); 
if (CGPDFPageGetPageNumber(myPageRef) == CGPDFDocumentGetNumberOfPages(myDocumentRef)) { 
    succBtn.enabled = NO; 
} 
precBtn.enabled = YES; 

[tiledLayer performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:0 waitUntilDone:NO]; 

,我用逐頁瀏覽PDF文檔頁面。

此代碼適用於iPhone 3.1.2及以上版本。

此代碼也適用於iPad。

但是...

此代碼不適用於iOS4。

performSelectorOnMainThread:@selector(setNeedsDisplay)不會觸發drawLayer方法,該方法讓我繪製要顯示的新頁面。

有人可以告訴我爲什麼?????

感謝提前。

回答

1

它可能與this race condition有關,你實施了一個空的-drawRect:

+0

是的,我沒有實現它的空。 – 2010-07-20 08:25:57