【问题标题】:Dismiss modal view form sheet controller on outside tap关闭外部水龙头上的模态视图表单控制器
【发布时间】:2012-02-24 12:39:03
【问题描述】:

我将模态视图控制器呈现为表单,并在单击取消按钮(它是条形按钮项)时将其关闭。当我在该视图之外点击时,我需要关闭它。请帮我参考。注意:我的模态视图控制器带有一个导航控制器。

@cli_hlt,@Bill Brasky 感谢您的回答。当点击发生在作为表单的模式视图之外时,我需要关闭它。我在下面粘贴我的代码。

-(void)gridView:(AQGridView *)gridView didSelectItemAtIndex:(NSUInteger)index  
{        
    if(adminMode) 
    {
        CHEditEmployeeViewController *editVC = [[CHEditEmployeeViewController alloc] initWithNibName:@"CHEditEmployeeViewController" bundle:nil];
        editVC.delegate = self;
        editVC.pickedEmployee = employee;
        editVC.edit = TRUE;
        editVC.delegate = self;
        UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:editVC];
        navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
        [self presentModalViewController:navigationController animated:YES];

        return;
    }   //the above code is from the view controller which presents the modal     view. Please look at the below code too which is from my modal view controller. Please guide me in a proper way.   -(void)tapGestureRecognizer {

    UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)];
    [recognizer setNumberOfTapsRequired:1];
    recognizer.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view
    [self.view addGestureRecognizer:recognizer];

}

- (void)handleTapBehind:(UITapGestureRecognizer *)sender
{
    if (sender.state == UIGestureRecognizerStateEnded) 
    {
        CGPoint location = [sender locationInView:nil]; //Passing nil gives us coordinates in the window

    //Then we convert the tap's location into the local view's coordinate system, and test to see if it's in or outside. If outside, dismiss the view.

        if (![self.view pointInside:[self.view convertPoint:location fromView:self.view.window] withEvent:nil]) 
        {
            [self dismissModalViewControllerAnimated:YES];
            [self.view.window removeGestureRecognizer:sender];
        }

    }
}

【问题讨论】:

    标签: objective-c xcode uinavigationcontroller modalviewcontroller


    【解决方案1】:

    基于一些问题并进行了一些改进和更新:

    - (void)tapOutsideDetected:(UITapGestureRecognizer *)sender {
        if (@available(iOS 13, *)) {} else {
            UIView *aView = self.navigationController ? self.navigationController.view : self.view;
            CGPoint location = [sender locationInView: aView];
            
            if (![aView pointInside:location withEvent:nil]) {
                [self removeGestureRecognizer:sender];
                [self dismissViewControllerAnimated:YES completion:nil];
            }
        }
    }
    

    地点:

    - (void) removeGestureRecognizer:(UIGestureRecognizer *) gesture {
        if (self.recognizer) {
            UIView *aView = self.recognizer.view;
            if (aView) {
                [aView removeGestureRecognizer:self.recognizer];
            }
        }
    }
    

    在这种情况下,UITapGestureRecognizer 已应用于 UIViewController

    【讨论】:

      【解决方案2】:

      仅供参考,iOS 13 表单现在有一个标准的关闭手势 - 当您触摸模式内的任何位置并向下滑动时,它们就会消失(如果您想防止这种情况,请将新的 isModalInPresentation 属性设置为 false) .

      【讨论】:

        【解决方案3】:

        Swift 4 版本,纵向和横向均可使用 - 无需交换 x、y。

        class TapBehindModalViewController: UIViewController, UIGestureRecognizerDelegate {
        private var tapOutsideRecognizer: UITapGestureRecognizer!
        
        override func viewDidAppear(_ animated: Bool) {
            super.viewDidAppear(animated)
        
            if (self.tapOutsideRecognizer == nil) {
                self.tapOutsideRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.handleTapBehind))
                self.tapOutsideRecognizer.numberOfTapsRequired = 1
                self.tapOutsideRecognizer.cancelsTouchesInView = false
                self.tapOutsideRecognizer.delegate = self
                self.view.window?.addGestureRecognizer(self.tapOutsideRecognizer)
            }
        }
        
        override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
        
            if(self.tapOutsideRecognizer != nil) {
                self.view.window?.removeGestureRecognizer(self.tapOutsideRecognizer)
                self.tapOutsideRecognizer = nil
            }
        }
        
        func close(sender: AnyObject) {
            self.dismiss(animated: true, completion: nil)
        }
        
        // MARK: - Gesture methods to dismiss this with tap outside
        @objc func handleTapBehind(sender: UITapGestureRecognizer) {
            if (sender.state == UIGestureRecognizerState.ended) {
                let location: CGPoint = sender.location(in: self.view)
        
                if (!self.view.point(inside: location, with: nil)) {
                    self.view.window?.removeGestureRecognizer(sender)
                    self.close(sender: sender)
                }
            }
        }
        
        func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
            return true
        }
        

        }

        【讨论】:

        • 对正确处理从 TapBehindModalViewController 呈现的视图控制器的小改进:func gestureRecognizer(_gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { return self.presentedViewController == nil }
        • 嗨!对我来说,handleTapBehind 根本没有被调用。
        【解决方案4】:

        我知道这是一个老问题,但这是可能的,尽管“正确”答案说了什么。由于这是我在寻找这个时的第一个结果,所以我决定详细说明:

        这就是你的做法:

        您需要将属性添加到要以模态方式呈现的视图控制器,在我的例子中是“tapBehindGesture”。

        然后在viewDidAppear

        if(!tapBehindGesture) {
                tapBehindGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBehindDetected:)];
                [tapBehindGesture setNumberOfTapsRequired:1];
                [tapBehindGesture setCancelsTouchesInView:NO]; //So the user can still interact with controls in the modal view
            }
        
        [self.view.window addGestureRecognizer:tapBehindGesture];
        

        这是 tapBehindDetected 的实现

        - (void)tapBehindDetected:(UITapGestureRecognizer *)sender
        {
        
            if (sender.state == UIGestureRecognizerStateEnded)
            {
                //(edited) not working for ios8 above 
                //CGPoint location = [sender locationInView:nil]; //Passing nil gives us coordinates in the window
        
                CGPoint location = [sender locationInView: self.presentingViewController.view];
        
                //Convert tap location into the local view's coordinate system. If outside, dismiss the view.
                if (![self.presentedViewController.view pointInside:[self.presentedViewController.view convertPoint:location fromView:self.view.window] withEvent:nil])
                {   
                    if(self.presentedViewController) {
                        [self dismissViewControllerAnimated:YES completion:nil];
                    }
                }
            }
        }
        

        请记住在viewWillDisappear 上从view.window 中删除tapBehindGesture,以避免在未分配的对象中触发handleTapBehind。

        【讨论】:

        • 运行良好 (iOS7)。使用此代码的其他人应注意self.presentedViewController.view。如果在模态视图控制器中实现手势,你应该只使用self.view
        • 有谁知道如何为 iOS8 解决这个问题?还是有更好的解决方案?
        • @Ares 作为 Kevin,我对 iOS8 也有疑问。我知道我们不应该在这里讨论测试版,所以请点击以下链接:devforums.apple.com/thread/243768
        • 从下方添加 UIGestureRecognizerDelegate 确实有效,但似乎convertPoint:fromView: 在 iOS8 中返回的值与在 iOS7 中不同,因此点击位置不准确。
        • 我通过以下代码更改了位置:CGPoint location = [tapSender locationInView: self.presentingViewController.view];
        【解决方案5】:

        斯威夫特 3

        class ModalParentViewController: UIViewController, UIGestureRecognizerDelegate {
        
        private var tapOutsideRecognizer: UITapGestureRecognizer!
        
        override func viewDidAppear(animated: Bool) {
            super.viewDidAppear(animated)
        
            if(self.tapOutsideRecognizer == nil) {
                self.tapOutsideRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.handleTapBehind))
                self.tapOutsideRecognizer.numberOfTapsRequired = 1
                self.tapOutsideRecognizer.cancelsTouchesInView = false
                self.tapOutsideRecognizer.delegate = self
                appDelegate.window?.addGestureRecognizer(self.tapOutsideRecognizer)
            }
        }
        
        override func viewWillDisappear(animated: Bool) {
            super.viewWillDisappear(animated)
        
              if(self.tapOutsideRecognizer != nil) {
                appDelegate.window?.removeGestureRecognizer(self.tapOutsideRecognizer)
                self.tapOutsideRecognizer = nil
            }
        }
        
        func close(sender: AnyObject) {
            self.dismiss(animated: true, completion: nil)
        }
        
        // MARK: - Gesture methods to dismiss this with tap outside
        func handleTapBehind(sender: UITapGestureRecognizer) {
            if (sender.state == UIGestureRecognizerState.ended) {
                let location: CGPoint = sender.location(in: nil)
        
                if (!self.view.point(inside: self.view.convert(location, from: self.view.window), with: nil)) {
                    self.view.window?.removeGestureRecognizer(sender)
                    self.close(sender: sender)
                }
            }
        }
        
        func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
            return true
        }
        

        }

        【讨论】:

        • 如何使用您的代码访问 appdelegate ?当我点击背景时没有任何附加内容
        • @BadrFilali UIApplication.shared.delegate?.window??.addGestureRecognizer(self.tapOutsideRecognizer)
        【解决方案6】:

        @yershuachu's answer,在 Swift 2 中:

        class ModalParentViewController: UIViewController, UIGestureRecognizerDelegate {
        
            private var tapOutsideRecognizer: UITapGestureRecognizer!
        
            override func viewDidAppear(animated: Bool) {
                super.viewDidAppear(animated)
        
                if(self.tapOutsideRecognizer == nil) {
                    self.tapOutsideRecognizer = UITapGestureRecognizer(target: self, action: "handleTapBehind:")
                    self.tapOutsideRecognizer.numberOfTapsRequired = 1
                    self.tapOutsideRecognizer.cancelsTouchesInView = false
                    self.tapOutsideRecognizer.delegate = self
                    self.view.window?.addGestureRecognizer(self.tapOutsideRecognizer)
                }
            }
        
            override func viewWillDisappear(animated: Bool) {
                super.viewWillDisappear(animated)
        
                if(self.tapOutsideRecognizer != nil) {
                    self.view.window?.removeGestureRecognizer(self.tapOutsideRecognizer)
                    self.tapOutsideRecognizer = nil
                }
            }
        
            func close(sender: AnyObject) {
                self.dismissViewControllerAnimated(true, completion: nil)
            }
        
            func handleTapBehind(sender: UITapGestureRecognizer) {
                if (sender.state == UIGestureRecognizerState.Ended) {
                    let location: CGPoint = sender.locationInView(nil)
        
                    if (!self.view.pointInside(self.view.convertPoint(location, fromView: self.view.window), withEvent: nil)) {
                        self.view.window?.removeGestureRecognizer(sender)
                        self.close(sender)
                    }
                }
            }
        
            func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
                return true
            }
        
        }
        

        【讨论】:

        • 似乎不再适用于 iOS 9。self.view.window?在模态呈现的视图控制器中为 nil
        • 我刚刚测试了这段代码在 Xcode 7 中运行良好。谢谢!
        【解决方案7】:

        基于Bart van Kuik's answerNavAutoDismiss 以及其他优秀的sn-ps。

        class DismissableNavigationController: UINavigationController, UIGestureRecognizerDelegate {
            private var tapOutsideRecognizer: UITapGestureRecognizer!
        
            override func viewDidAppear(animated: Bool) {
                super.viewDidAppear(animated)
        
                if tapOutsideRecognizer == nil {
                    tapOutsideRecognizer = UITapGestureRecognizer(target: self, action: #selector(DismissableNavigationController.handleTapBehind))
                    tapOutsideRecognizer.numberOfTapsRequired = 1
                    tapOutsideRecognizer.cancelsTouchesInView = false
                    tapOutsideRecognizer.delegate = self
                    view.window?.addGestureRecognizer(tapOutsideRecognizer)
                }
            }
        
            override func viewWillDisappear(animated: Bool) {
                super.viewWillDisappear(animated)
        
                if tapOutsideRecognizer != nil {
                    view.window?.removeGestureRecognizer(tapOutsideRecognizer)
                    tapOutsideRecognizer = nil
                }
            }
        
            func close(sender: AnyObject) {
                dismissViewControllerAnimated(true, completion: nil)
            }
        
            func handleTapBehind(sender: UITapGestureRecognizer) {
                if sender.state == UIGestureRecognizerState.Ended {
                    var location: CGPoint = sender.locationInView(nil)
        
                    if UIInterfaceOrientationIsLandscape(UIApplication.sharedApplication().statusBarOrientation) {
                        location = CGPoint(x: location.y, y: location.x)
                    }
        
                    if !view.pointInside(view.convertPoint(location, fromView: view.window), withEvent: nil) {
                        view.window?.removeGestureRecognizer(sender)
                        close(sender)
                    }
                }
            }
        
            func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
                return true
            }
        }
        

        用法:

        let vc = MyViewController()
        let nc = DismissableNavigationController(rootViewController: vc)
        nc.modalPresentationStyle = UIModalPresentationStyle.FormSheet
        presentViewController(nc, animated: true, completion: nil)
        

        【讨论】:

          【解决方案8】:

          我以这种形式使用它,在 iOS 7.1 和 iOS 8.3 上都没有任何问题。

          - (void)viewDidAppear:(BOOL)animated
          {
               [super viewDidAppear:animated];
          
               [self.view.window addGestureRecognizer:self.tapBehindGesture];
          }
          
          - (void)viewWillDisappear:(BOOL)animated
          {
               [super viewWillDisappear:animated];
          
               [self.view.window removeGestureRecognizer:self.tapBehindGesture];
          }
          
          - (UITapGestureRecognizer*)tapBehindGesture
          {    
              if (_tapBehindGesture == nil)
              {
                  _tapBehindGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBehindRecognized:)];
                  _tapBehindGesture.numberOfTapsRequired = 1;
                  _tapBehindGesture.cancelsTouchesInView = NO;
                  _tapBehindGesture.delegate = self;
              }
          
              return _tapBehindGesture;
          }
          
          - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
          {
              return YES;
          }
          

          【讨论】:

            【解决方案9】:

            据我所知,似乎没有一个答案在每种情况下都能立即奏效。

            我的解决方案(继承或粘贴):

            @interface MyViewController () <UIGestureRecognizerDelegate>
            
            @property (strong, nonatomic) UITapGestureRecognizer *tapOutsideRecognizer;
            
            @end
            
            -(void)viewDidAppear:(BOOL)animated
            {
                [super viewDidAppear:animated];
                if (!self.tapOutsideRecognizer) {
                    self.tapOutsideRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)];
                    self.tapOutsideRecognizer.numberOfTapsRequired = 1;
                    self.tapOutsideRecognizer.cancelsTouchesInView = NO;
                    self.tapOutsideRecognizer.delegate = self;
                    [self.view.window addGestureRecognizer:self.tapOutsideRecognizer];
                }
            }
            
            -(void)viewWillDisappear:(BOOL)animated
            {
                [super viewWillDisappear:animated];
                // to avoid nasty crashes
                if (self.tapOutsideRecognizer) {
                    [self.view.window removeGestureRecognizer:self.tapOutsideRecognizer];
                    self.tapOutsideRecognizer = nil;
                }
            }
            
            #pragma mark - Actions 
            
            - (IBAction)close:(id)sender
            {
                [self dismissViewControllerAnimated:YES completion:nil];
            }
            
            - (void)handleTapBehind:(UITapGestureRecognizer *)sender
            {
                if (sender.state == UIGestureRecognizerStateEnded)
                {
                    CGPoint location = [sender locationInView:nil]; //Passing nil gives us coordinates in the window
            
                    //Then we convert the tap's location into the local view's coordinate system, and test to see if it's in or outside. If outside, dismiss the view.
            
                    if (![self.view pointInside:[self.view convertPoint:location fromView:self.view.window] withEvent:nil])
                    {
                        // Remove the recognizer first so it's view.window is valid.
                        [self.view.window removeGestureRecognizer:sender];
                        [self close:sender];
                    }
                }
            }
            
            #pragma mark - Gesture Recognizer
            // because of iOS8
            - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
                return YES;
            }
            

            【讨论】:

            • 感谢您的回答,我用 Swift 翻译了它,见下文
            • 为什么要去掉tapBehind方法中的手势识别器?解雇后 viewWillDisappear 不会发生这种情况吗?
            【解决方案10】:

            这是适用于 iOS 7 和 iOS 8 且不需要条件交换坐标的版本:

            - (void)handleTapBehind:(UITapGestureRecognizer *)sender
            {
                if (sender.state == UIGestureRecognizerStateEnded)
                {
                    CGPoint location = [sender locationInView:self.view];
            
                    if (![self.view pointInside:location withEvent:nil]) {
                        [self.view.window removeGestureRecognizer:self.recognizer];
                        [self dismissViewControllerAnimated:YES completion:nil];
                    }
                }
            }
            

            【讨论】:

            • 这个答案真的很简单,很有意义,并且像宣传的那样工作。我有点困惑为什么其他答案试图做一些更复杂的事情。
            • 很好的答案。在 iOS8 中像魅力一样工作。
            • 它不适用于横向(iOS8 - iPad)。
            【解决方案11】:

            我为 iPad 制作了一个可以自动关闭的 navigationController

            https://github.com/curciosobrinho/NavAutoDismiss

            与上面的代码相同,适用于 iOS 8。

            所以,所有的功劳都归于上面的人。

            我只是为了更通用和更易于使用。

            您只需将两个文件复制到您的项目中

            导入头文件(.h)

            并使用您的视图控制器(您要显示的)作为 rootViewController。

            使用方法:

            //Import the .h file
            #import "NavDismissViewController.h"
            
            //Instanciate your view controller (the view you want to present)
            
            YourViewController * yourVC = [YourViewController new];
            
            //Instanciate the NavDismissViewController with your view controller as the rootViewController
            
            NavDismissViewController *nav = [[NavDismissViewController alloc] initWithRootViewController:yourVC];
            
            //if you want to change the navigationBar translucent behaviour
            
            [nav.navigationBar setTranslucent:NO];
            
            //Choose the Modal style
            
            nav.modalPresentationStyle=UIModalPresentationFormSheet;
            
            //present your controller
            
            [self presentViewController:nav animated:YES completion:nil];
            
            //Done
            

            【讨论】:

              【解决方案12】:

              对于 iOS 8,您必须按照 Martino 的回答实现UIGestureRecognizer,并在横向时交换点击位置的 (x,y) 坐标。不确定这是否是由于 iOS 8 错误造成的。

              - (void) viewDidAppear:(BOOL)animated
              {
                  [super viewDidAppear:animated];
              
                  // add gesture recognizer to window
              
                  UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)];
                  [recognizer setNumberOfTapsRequired:1];
                  recognizer.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view
                  [self.view.window addGestureRecognizer:recognizer];
                  recognizer.delegate = self;
              }
              
              - (void)handleTapBehind:(UITapGestureRecognizer *)sender
              {
                  if (sender.state == UIGestureRecognizerStateEnded) {
              
                      // passing nil gives us coordinates in the window
                      CGPoint location = [sender locationInView:nil];
              
                      // swap (x,y) on iOS 8 in landscape
                      if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
                          if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
                              location = CGPointMake(location.y, location.x);
                          }
                      }
              
                      // convert the tap's location into the local view's coordinate system, and test to see if it's in or outside. If outside, dismiss the view.
                      if (![self.view pointInside:[self.view convertPoint:location fromView:self.view.window] withEvent:nil]) {
              
                          // remove the recognizer first so it's view.window is valid
                          [self.view.window removeGestureRecognizer:sender];
                          [self dismissViewControllerAnimated:YES completion:nil];
                      }
                  }
              }
              
              
              #pragma mark - UIGestureRecognizer Delegate
              
              - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
              {
                  return YES;
              }
              
              - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
              {
                  return YES;
              }
              
              - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
              {
                  return YES;
              }
              

              【讨论】:

              • 在 iOS 8 GM 上,我不需要这样做,所以它一定是一个已经修复的错误。
              • 尚未修复,我需要在 iOS 8.0.2 上应用此修复
              • @Erich 再次在 iPad 上的横向模式下,您的答案会检测到模式视图内的点击,但不会检测到外部的点击。
              【解决方案13】:

              我通过向手势识别器添加委托解决了 iOS 8 问题

              [taprecognizer setDelegate:self];
              

              这些回应

              #pragma mark - UIGestureRecognizer Delegate
              
              - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
                  return YES;
              }
              
              - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
                  return YES;
              }
              
              - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
                  return YES;
              }
              

              适用于 iOS 8 GM 的我

              【讨论】:

              • 成功了!特别是gestureRecognizer: shouldRecognizeSimultaneouslyWithGestureRecognizer需要实现返回YES
              • 横向坐标也有问题。在这里查看我的解决方案:stackoverflow.com/a/25844208/118293
              【解决方案14】:

              嗯,好的。所以我担心使用 presentModalViewController: 方法不太可能。 “模态”视图/窗口/消息框/等的整个想法。 pp. 用户不能做任何事情,除了处理任何视图/窗口/消息框/等。 pp.希望他/她这样做。

              您想要做的不是呈现模态视图控制器,而是以常规方式加载并显示您的表单视图控制器。请注意,在您的主控制器中,表单只是显示,例如使用 BOOL 变量,然后在那里处理可能发生的任何水龙头。如果您的表单正在显示,请将其关闭。

              【讨论】:

              • 如果您点击模态视图内未连接的任何内容,这也会关闭模态。 (空格等)
              • 我认为他/她的意图是在点击表单元素外部时关闭模式 - 而不仅仅是取消按钮?
              • 可能。只是觉得值得一提,以防万一没有给出预期的结果。这个问题似乎是他们希望在表单视图之外点击时忽略它,所以想让事情变得清晰。
              • 我已经编辑了我的问题,请看一下。谢谢。
              猜你喜欢
              • 1970-01-01
              • 2013-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多