【发布时间】:2016-03-01 12:20:16
【问题描述】:
我使用下面的代码在我的组件中设置 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 阻止滚动提要视图。为了解决这个问题,我想使用UIGestureRecognizerDelegate 协议并允许两个(滚动视图和我的平移)识别器同时工作。
我的问题是如何将我的组件控制器分配为UIPanGestureRecognizer 的代表? setupPanRecognizer 只是一个C function,它没有引用MyComponentController 对象甚至组件本身。
我现在看到的唯一方法是在控制器的 didUpdateComponent 方法中的某处获取手势识别器列表,找到正确的并在那里分配委托。
ComponentKit 是否提供任何解决方案?
【问题讨论】:
标签: ios objective-c componentkit