1. <tfoot id='oSo9V'></tfoot>

        <legend id='oSo9V'><style id='oSo9V'><dir id='oSo9V'><q id='oSo9V'></q></dir></style></legend>

          <bdo id='oSo9V'></bdo><ul id='oSo9V'></ul>
        <i id='oSo9V'><tr id='oSo9V'><dt id='oSo9V'><q id='oSo9V'><span id='oSo9V'><b id='oSo9V'><form id='oSo9V'><ins id='oSo9V'></ins><ul id='oSo9V'></ul><sub id='oSo9V'></sub></form><legend id='oSo9V'></legend><bdo id='oSo9V'><pre id='oSo9V'><center id='oSo9V'></center></pre></bdo></b><th id='oSo9V'></th></span></q></dt></tr></i><div id='oSo9V'><tfoot id='oSo9V'></tfoot><dl id='oSo9V'><fieldset id='oSo9V'></fieldset></dl></div>

        <small id='oSo9V'></small><noframes id='oSo9V'>

        关闭外部水龙头上的模态视图表单控制器

        Dismiss modal view form sheet controller on outside tap(关闭外部水龙头上的模态视图表单控制器)
        • <bdo id='JwJoK'></bdo><ul id='JwJoK'></ul>
          • <tfoot id='JwJoK'></tfoot>
            <legend id='JwJoK'><style id='JwJoK'><dir id='JwJoK'><q id='JwJoK'></q></dir></style></legend>

              <small id='JwJoK'></small><noframes id='JwJoK'>

                <i id='JwJoK'><tr id='JwJoK'><dt id='JwJoK'><q id='JwJoK'><span id='JwJoK'><b id='JwJoK'><form id='JwJoK'><ins id='JwJoK'></ins><ul id='JwJoK'></ul><sub id='JwJoK'></sub></form><legend id='JwJoK'></legend><bdo id='JwJoK'><pre id='JwJoK'><center id='JwJoK'></center></pre></bdo></b><th id='JwJoK'></th></span></q></dt></tr></i><div id='JwJoK'><tfoot id='JwJoK'></tfoot><dl id='JwJoK'><fieldset id='JwJoK'></fieldset></dl></div>
                  <tbody id='JwJoK'></tbody>
                  本文介绍了关闭外部水龙头上的模态视图表单控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

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

                  I am presenting a modal view controller as a form sheet and dismissing it when the cancel button, which is a bar button item, is clicked. I need to dismiss it when I tap on outside of that view. Please help me with a reference. Note: my modal view controller is presented with a navigation controller.

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

                  @cli_hlt, @Bill Brasky thanks for your answer. I need to dismiss it when tap occurs outside of the modal view which is a form sheet. I am pasting my code below.

                  -(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];
                          }
                  
                      }
                  }
                  

                  推荐答案

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

                  Ah ok. So I'm afraid thats not quite possible using the presentModalViewController: method. The whole idea of a "modal" view/window/message box/etc. pp. is that the user cannot do anything else than processing whatever the view/window/message box/etc. pp. wants him/her to do.

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

                  What you want to do instead is not present a modal view controller, but rather load and show your form view controller the regular way. Note in your master controller that the form is just showing e.g. with a BOOL variable and then handle there any taps that might occur. If your form is showing, dismiss it.

                  这篇关于关闭外部水龙头上的模态视图表单控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                  How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                  How can you rotate text for UIButton and UILabel in Objective-C?(如何在 Objective-C 中旋转 UIButton 和 UILabel 的文本?)
                  How to build Cocoa Touch Framework for i386 and x86_64 architecture?(如何为 i386 和 x86_64 架构构建 Cocoa Touch 框架?)
                  Can I embed a custom font in a bundle and access it from an ios framework?(我可以在包中嵌入自定义字体并从 ios 框架访问它吗?)
                  Undefined symbols for architecture armv7: quot;_SCNetworkReachabilityCreateWithAddressquot;(架构 armv7 的未定义符号:“_SCNetworkReachabilityCreateWithAddress)
                • <tfoot id='YAjSh'></tfoot>

                      <tbody id='YAjSh'></tbody>
                      <bdo id='YAjSh'></bdo><ul id='YAjSh'></ul>
                        • <small id='YAjSh'></small><noframes id='YAjSh'>

                          <legend id='YAjSh'><style id='YAjSh'><dir id='YAjSh'><q id='YAjSh'></q></dir></style></legend>

                          • <i id='YAjSh'><tr id='YAjSh'><dt id='YAjSh'><q id='YAjSh'><span id='YAjSh'><b id='YAjSh'><form id='YAjSh'><ins id='YAjSh'></ins><ul id='YAjSh'></ul><sub id='YAjSh'></sub></form><legend id='YAjSh'></legend><bdo id='YAjSh'><pre id='YAjSh'><center id='YAjSh'></center></pre></bdo></b><th id='YAjSh'></th></span></q></dt></tr></i><div id='YAjSh'><tfoot id='YAjSh'></tfoot><dl id='YAjSh'><fieldset id='YAjSh'></fieldset></dl></div>