UITapGestureRecogniser在切换回ViewController后无法正常工作

时间:2019-04-30 05:54:28

标签: ios objective-c uitapgesturerecognizer

我在containerview子视图上添加了Tap手势。当我从菜单切换回视图控制器时,Tapgesture操作不会触发。初始根视图正在从情节提要中加载。在家时,其切换根视图如下所示。

 AppDelegate *appDelegate;
 appDelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
 UIViewController *vc ;
 vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"HomeView"];
[[SlideNavigationController sharedInstance]popAllAndSwitchToViewController:vc withCompletion:nil];

我尝试由所有手势识别器进行打印,以确认是否添加了手势。

NSArray *gestureRecognizers = self.view.gestureRecognizers;

O / P

<__NSSingleObjectArrayI 0x282dcab80>(
<UITapGestureRecognizer: 0x2813eba00; state = Possible; view = <UIView 0x10d21c1c0>; target= <(action=didTapGesture:, target=<TV2ZPlayerOverlayVC 0x106016600>)>>
)

TapGesture

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapGesture:)];
tap.delegate = self;
[self.view addGestureRecognizer:tap];

0 个答案:

没有答案