开发者

problem when swipe using very fast

I am developing an pdf reader in which i have to load each page of the pdf book on finger swipe. For each swipe i am incrementing one page it is working fine if i am swiping slowly.where it is not at all working if the swipe is so fast it gets crashed.

hi folks i resolved the above issue with the NSobject class reference it has only two lines..

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(loadPagesAccordingToCurrentOrientation) obj开发者_JS百科ect:nil];
[self performSelector:@selector(loadPagesAccordingToCurrentOrientation) withObject:nil afterDelay:0.5];


I cant be sure but It feels like you are not accounting for the use case where one page may not have finished rendering while another comes into the pipe.

The line in

loadSinglePageWithWidth:(float)width andHeight:(float)height

myPageRef = CGPDFDocumentGetPage(...

feels especially unstable even if wrapped in the @synchronised pragma.

I think you need to account for that situation and cancel any existing renderings/animations before allowing the next one to begin.

SO isnt a debugger.


some of the code is used for my problem

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(loadPagesAccordingToCurrentOrientation) object:nil];

[self performSelector:@selector(loadPagesAccordingToCurrentOrientation) withObject:nil afterDelay:0.5];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜