我使用下面的代码在我的组件中设置 UIPanGestureRecognizer:
MyComponent *c =[super newWithView:{
[UIView class],
{
{
CKComponentGestureAttribute(
[UIPanGestureRecognizer class],
&setupPanRecognizer,
@selector(panGesture:context:),
{}
)
},
{
@selector(setUserInteractionEnabled:), @YES
}
}
}
component: [MyOtherComponent newOtherComponentWithMode:model context:context]];
我panGesture:context
在 MyComponentController 对象中处理。
我的问题是UIPanGestureRecognizer
阻止滚动提要视图。为了解决这个问题,我想使用UIGestureRecognizerDelegate
协议并允许两个(滚动视图和我的平移)识别器同时工作。
我的问题是如何将我的组件控制器分配为代表UIPanGestureRecognizer
?setupPanRecognizer
只是一个C function
,它没有对MyComponentController
对象甚至组件本身的引用。
我现在看到的唯一方法是didUpdateComponent
在我的控制器的方法中的某处获取手势识别器列表,找到正确的并在那里分配委托。ComponentKit 是否为此提供任何解决方案?