我使用下面的代码在我的组件中设置UIPanGestureRecognizer:
MyComponent *c =[super newWithView:{
[UIView class],
{
{
CKComponentGestureAttribute(
[UIPanGestureRecognizer class],
&setupPanRecognizer,
@selector(panGesture:context:),
{}
)
},
{
@selector(setUserInteractionEnabled:), @YES
}
}
}
component: [MyOtherComponent newOtherComponentWithMode:model context:context]];我在MyComponentController对象中处理panGesture:context。
我的问题是UIPanGestureRecognizer阻止了提要视图的滚动。
我的问题是,如何将组件控制器指定为UIPanGestureRecognizer的委托?setupPanRecognizer只是一个C function,它没有对MyComponentController对象的引用,甚至没有对组件本身的引用。
我现在看到的唯一方法是在我的控制器的didUpdateComponent方法中的某个地方获得手势识别器的列表,找到正确的一个,并在那里分配委托。ComponentKit对此有什么解决方案吗?
发布于 2016-01-02 21:46:29
CKComponentViewAttributeValue CKComponentGestureAttribute(Class gestureRecognizerClass,
CKComponentGestureRecognizerSetupFunction setupFunction,
CKComponentAction action,
CKComponentForwardedSelectors delegateSelectors)最后你可以找到"delegateSelectors“参数,这样你就可以尝试传递一个选择器的向量,你想在控制器中响应它。
https://stackoverflow.com/questions/33954982
复制相似问题