<tfoot id='82TTG'></tfoot>
      <bdo id='82TTG'></bdo><ul id='82TTG'></ul>
  • <small id='82TTG'></small><noframes id='82TTG'>

    1. <legend id='82TTG'><style id='82TTG'><dir id='82TTG'><q id='82TTG'></q></dir></style></legend>

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

        停止 segue 并显示警报

        时间:2023-06-01

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

              <bdo id='MJCvl'></bdo><ul id='MJCvl'></ul>
            • <legend id='MJCvl'><style id='MJCvl'><dir id='MJCvl'><q id='MJCvl'></q></dir></style></legend>

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

                <tbody id='MJCvl'></tbody>

              1. <tfoot id='MJCvl'></tfoot>
                1. 本文介绍了停止 segue 并显示警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  使用 iOS 5 故事板,在一个按钮上我正在执行 segue,我想要对我的文本字段进行验证,如果验证失败,我必须停止 segue 并发出警报.有什么办法吗?

                  Using iOS 5 storyboards, on a button I am performing a segue, what I want is to do validation on my textfield and if validation is failed I have to stop segue and throw an alert. Whats the way to do it?

                  推荐答案

                  如果您的部署目标是 iOS 6.0 或更高版本

                  您可以在源视图控制器上简单地实现 shouldPerformSegueWithIdentifier:sender: 方法.如果你想执行segue,让这个方法返回YES,如果你不想,则返回NO.

                  If your deployment target is iOS 6.0 or later

                  You can simply implement the shouldPerformSegueWithIdentifier:sender: method on your source view controller. Make this method return YES if you want to perform the segue, or NO if you don't.

                  您需要更改故事板中的 segue 连接方式并编写更多代码.

                  You will need to change the way your segue is connected in the storyboard and write a little more code.

                  首先,设置从按钮的视图控制器到目标视图控制器的 segue,而不是直接从按钮到目标.给 segue 一个标识符,如 ValidationSucceeded.

                  First, set up the segue from the button's view controller to the destination view controller, instead of directly from the button to the destination. Give the segue an identifier like ValidationSucceeded.

                  然后,将按钮连接到其视图控制器上的操作.在操作中,执行验证并根据验证是否成功执行 segue 或显示警报.它看起来像这样:

                  Then, connect the button to an action on its view controller. In the action, perform the validation and either perform the segue or show an alert based on whether the validation succeeded. It will look something like this:

                  - (IBAction)performSegueIfValid:(id)sender {
                      if ([self validationIsSuccessful]) {
                          [self performSegueWithIdentifier:@"ValidationSucceeded" sender:self];
                      } else {
                          [self showAlertForValidationFailure];
                      }
                  }
                  

                  这篇关于停止 segue 并显示警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:iOS 5 故事板,以编程方式确定路径 下一篇:如何通过点击动画 UIImageview 以显示全屏?

                  相关文章

                  最新文章

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

                    • <bdo id='vCdze'></bdo><ul id='vCdze'></ul>
                  1. <tfoot id='vCdze'></tfoot>

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

                    1. <legend id='vCdze'><style id='vCdze'><dir id='vCdze'><q id='vCdze'></q></dir></style></legend>