タッチされたビューの UIViewController への参照を取得するにはどうすればよいですか?
UIViewController のビューで UIPanGestureRecognizer を使用しています。これを初期化する方法は次のとおりです。
TaskUIViewController *thisTaskController = [[TaskUIViewController alloc]init];
[[self view]addSubview:[thisTaskController view]];
UIPanGestureRecognizer *panRec = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(handlePan:)];
[[thisTaskController view] addGestureRecognizer:panRec];
ジェスチャ認識エンジンを使用してトリガーされたトリガーされたアクションでは、reckearizer.view を使用してパラメーターからビューを取得できます。
- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {
UIView *touchedView = [[UIView alloc]init];
touchedView = (UIView*)[recognizer view];
...
}
しかし、私が本当に必要としているのは、触れたビューの基礎となる UIViewController です。UIView だけでなく、このビューを含む UIViewController への参照を取得するにはどうすればよいですか?