我有这段代码:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
[self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:nil afterDelay:0.01];
}
- (void) scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView{
[NSObject cancelPreviousPerformRequestsWithTarget:self];
if (scrollView == scrollV){
NSLog(@"scroll di scrollV");
}
}
我不明白为什么它不能在控制台“scroll di scrollV”中打印,我为scrollV设置了委托,但它不起作用
答案 0 :(得分:0)
你想要这个吗?:
[self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:scrollView afterDelay:0.01];
您没有传递scrollView
对象,因此if (scrollView == scrollV)
永远不会被击中,除非scrollV
是nil
,我猜它不是。{/ p>