问题描述
我正在开发一个pdf阅读器,我必须在手指滑动上加载pdf书的每一页。对于每次滑动,我正在递增一个页面,如果我正在慢慢地滑动它工作正常。如果滑动如此之快它就会崩溃,它根本不起作用。
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.
大家好我用NSobject类引用解决了上面的问题它只有两行...
hi folks i resolved the above issue with the NSobject class reference it has only two lines..
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(loadPagesAccordingToCurrentOrientation) object:nil];
[self performSelector:@selector(loadPagesAccordingToCurrentOrientation) withObject:nil afterDelay:0.5];
推荐答案
一些代码用于我的问题
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(loadPagesAccordingToCurrentOrientation)object:nil];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(loadPagesAccordingToCurrentOrientation) object:nil];
[self performSelector:@选择器(loadPagesAccordingToCurrentOrientation)withObject:nil afterDelay:0.5];
[self performSelector:@selector(loadPagesAccordingToCurrentOrientation) withObject:nil afterDelay:0.5];
这篇关于使用非常快速的滑动时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!