タブバー コントローラーを使用してプロジェクトを作成しました。タブには 5 つのボタンがあります。最初のタブでダブルタップ ジェスチャ レコグナイザーを実行したいと考えています。
タブバーでジェスチャーを行うことができましたが、タブバーの任意のボタンをダブルタップすると、メソッドが呼び出されます。単一のタブバーボタン専用にする方法は?
-(void)createTab{
Array = [[NSMutableArray alloc] initWithCapacity:5];
myhomeVC = [[MyHomeViewController alloc] initWithNibName:@"MyHomeViewController" bundle:nil];
homeNavBar=[[UINavigationController alloc]initWithRootViewController:myhomeVC];
groupVC = [[GroupSearchViewController alloc] initWithNibName:@"GroupSearchViewController" bundle:nil];
groupNavBar=[[UINavigationController alloc]initWithRootViewController:groupVC];
uploadVC = [[UploadFoodImageViewController alloc] initWithNibName:@"UploadFoodImageViewController" bundle:nil];
uploadNavBar=[[UINavigationController alloc]initWithRootViewController:uploadVC];
searchVC = [[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
searchNavBar=[[UINavigationController alloc]initWithRootViewController:searchVC];
nearbyVC = [[NearByViewController alloc] initWithNibName:@"NearByViewController" bundle:nil];
nearbyNavBar=[[UINavigationController alloc]initWithRootViewController:nearbyVC];
[Array addObject:homeNavBar];
[Array addObject:groupNavBar];
[Array addObject:uploadNavBar];
[Array addObject:searchNavBar];
[Array addObject:nearbyNavBar];
appDelegate.tabBarController.viewControllers =Array;
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTap setNumberOfTapsRequired:2];
[appDelegate.tabBarController.view addGestureRecognizer:doubleTap];
}
-(void)handleDoubleTap:(UIGestureRecognizer *)gestureRecognizer {
NSLog(@"Tab tpped");
}