【问题标题】:How to disable the interaction of front view but if we tap on fron view then rear view should close in swrevealview controller如何禁用前视图的交互,但是如果我们点击前视图,则后视图应该在 swrevealviewcontroller 中关闭
【发布时间】:2017-01-14 02:05:21
【问题描述】:

单击菜单后我正在使用我想要的 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 objective-c swrevealviewcontroller


    【解决方案1】:

    听起来您是在说您希望顶视图允许点击(或手势)传递到其下方的视图。

    如果是这样,这里有一些 Stack Overflow 答案可以帮助您:

    How to send touch events to superview in iOS?

    iOS - forward all touches through a view

    【讨论】:

      猜你喜欢
      • 2014-04-12
      • 2014-05-01
      • 2017-05-17
      • 2015-07-03
      • 2016-10-03
      • 1970-01-01
      • 2017-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多