ios - ObjC 未正确转发 scrollViewDidScroll 消息

标签 ios uiscrollview runtime message forwarding

我想为 UIScrollViewDelegate 使用多播委托(delegate)技术.我的总体想法与此类似:
https://github.com/tkach/MulticastDelegate/blob/master/MulticastDelegate/MulticastDelegate.m

但我无法转发 scrollViewDidScroll消息,我发现我从来没有收到过这条消息。
那么有没有人遇到或者知道这是什么原因呢?
谢谢...

最佳答案

我认为 UIScroll出于某种性能原因,将缓存其委托(delegate)。您必须 首先准备您的多播委托(delegate) .然后将原始委托(delegate)设置为 UIScroll .最后 UIScroll会知道你已经实现了 scrollViewDidScroll方法。

当您想更改您的多播委托(delegate)时,请记住重置 UIScroll 的原始委托(delegate)像这样:

self.scrollView.delegate = nil;
self.scrollView.delegate = yourMulticastDelegate;

关于ios - ObjC 未正确转发 scrollViewDidScroll 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34205570/

相关文章:

iOS:UIScrollView 检测滑动手势

ios - 增加所有文本字段上的文本大小

ios - ARKit 在 ARWorldTrackingConfiguration 和 ARFaceTrackingConfiguration 之间切换 - 后置和前置摄像头

c++ - Mex 运行时错误 : Unexpected standard expression

java - 在运行时替换某些方法的内容

ios - iOS 加速度计的高通滤波器方程未返回良好结果

iphone - 通过 UITapGestureRecognizer 获取 UIScrollView 中的触摸点

iphone - 为什么当 UIImageView 放置在 UIScrollView 中时,touchesBegan 停止工作?

ios - UIScrollView 覆盖 NavigationBar

python - 如何在打印输出中传递RuntimeWarning?