繁体   English   中英

如何禁用前视图的交互,但是如果我们点击fron视图,则后视图应在swrevealview控制器中关闭

[英]How to disable the interaction of front view but if we tap on fron view then rear view should close in swrevealview controller

我使用的是swreveal视图控制器,我想在单击菜单后单击,然后如果我们单击前视图然后后部应该关闭,则我们将无法与前视图交互。 我正在使用下面的代码来禁用交互,但是如果我们禁用交互,那么点击guesture也将不起作用。

 - (void)revealController:(SWRevealViewController *)revealController willMoveToPosition:    (FrontViewPosition)position {
if(position == FrontViewPositionLeft) {
    self.view.userInteractionEnabled = YES;
} else {
    self.view.userInteractionEnabled = NO;
}
}

- (void)revealController:(SWRevealViewController *)revealController didMoveToPosition:    (FrontViewPosition)position {
if(position == FrontViewPositionLeft) {
    self.view.userInteractionEnabled = YES;
} else {
    self.view.userInteractionEnabled = YES;
  hideFilter=[[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];

    hideFilter.backgroundColor=[UIColor blueColor];
    [self.view addSubview:hideFilter];

    SWRevealViewController *reveal = self.revealViewController;
    reveal.delegate = self;
    if ( reveal )
    {
        [hideFilter addGestureRecognizer:self.revealViewController.tapGestureRecognizer];
        [hideFilter addGestureRecognizer:self.revealViewController.panGestureRecognizer];
    }
  }
}

我使用了hidefilter隐藏self.view的交互并在其上添加一个手势,但是单击它之后,该视图应删除并交互主视图。 那我该怎么做 如果还有另一种方法,请告诉谢谢

听起来您是在说要让顶视图允许点击(或手势)直通到其下面的视图。

如果是这样,这里有一些堆栈溢出答案,将对您有所帮助:

如何在iOS中将触摸事件发送到Superview?

iOS-通过视图转发所有触摸

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM