IOS:许多scrollViews的委托

时间:2012-01-16 15:05:06

标签: ios xcode delegates uiscrollview

我有这段代码:

- (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设置了委托,但它不起作用

1 个答案:

答案 0 :(得分:0)

你想要这个吗?:

[self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:scrollView afterDelay:0.01];

您没有传递scrollView对象,因此if (scrollView == scrollV)永远不会被击中,除非scrollVnil,我猜它不是。{/ p>