次のコードを使用して、コンポーネントで 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 はこれに対する解決策を提供しますか?