我在scrollView中有一个方法:didScroll像这样:
[self.navigationCollectionView moveWhiteLineToPointX:middleX WithWidth:middleWidth animated:NO];
如果用户快速滚动,我不希望多次调用此方法,所以我想使用+cancelPreviousPerformRequestsWithTarget:selector:object
+ (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(id)anArgument
我不知道如何为此API提供正确的参数,尤其是目标和参数。有人可以帮忙吗?
答案 0 :(得分:0)
试试这个
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(scrollViewDidScroll:) object:nil];
答案 1 :(得分:0)
取消:
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(yourSelectorFunction) object:nil];
并且用于调用执行选择器:
[self performSelector:@selector(yourSelectorFunction) withObject:nil afterDelay:0.4];