• <small id='MWnI7'></small><noframes id='MWnI7'>

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

        当从同一个组件调用时,两个 IBAction 触发的顺序是什么?

        时间:2024-04-14
      1. <tfoot id='94DVO'></tfoot>
          <bdo id='94DVO'></bdo><ul id='94DVO'></ul>

          <small id='94DVO'></small><noframes id='94DVO'>

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

                • 本文介绍了当从同一个组件调用时,两个 IBAction 触发的顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UIButton,我试图从一个 UIButton 事件中调用 2 个不同的操作,因为该按钮需要做两件事,但我需要按一定的顺序来做.

                  I have a UIButton and I am trying to call 2 different actions from one UIButton event, since that button needs to do two things, but I need to do them in a certain order.

                  无论我如何尝试,我似乎都无法更改动作触发的顺序.有没有办法让我决定这个,还是随机的?

                  No matter how I try, I can't seem to change the order in which the Actions fire. Is there a way for me to decide this, or is it random?

                  IBActions 从同一个组件中被触发的顺序是什么?有没有办法按一定的顺序调用它们?

                  In what order do IBActions get fired from the same component? Is there a way to call them in a certain order?

                  推荐答案

                  这个问题的答案很简单,只是有点奇怪.IBAction 按字母顺序调用.请参阅下面的示例.

                  The answer to this is quite simple, all be it a bit strange. IBActions are called in alphabetical order. See below for an example.

                  以下是 6 个 IBAction 方法,它们都打印出它们是哪种方法.

                  Below are 6 IBAction methods all printing out which method they are.

                  .h 文件中...

                  - (IBAction)a:(id)sender;
                  - (IBAction)b:(id)sender;
                  - (IBAction)c:(id)sender;
                  - (IBAction)d:(id)sender;
                  

                  .m 文件中...

                  - (IBAction)a:(id)sender {
                     NSLog(@"a");
                  }
                  - (IBAction)b:(id)sender {
                     NSLog(@"b");
                  }
                  - (IBAction)c:(id)sender {
                     NSLog(@"c");
                  }
                  - (IBAction)d:(id)sender {
                     NSLog(@"d");
                  }
                  

                  当我点击链接到所有这些的按钮时,我得到以下日志...

                  When I tap on the button linked to all these I get the following log...

                  2013-06-05 18:06:52.637 TestIBAction[49798:c07] a
                  2013-06-05 18:06:52.637 TestIBAction[49798:c07] b
                  2013-06-05 18:06:52.637 TestIBAction[49798:c07] c
                  2013-06-05 18:06:52.637 TestIBAction[49798:c07] d
                  

                  如果您按字母顺序查看它们,它们被解雇如下;a, b, b, d, e, f 生成显示的日志.即使您重新安排 IBAction 或以不同方式链接它们,也会生成相同的日志.

                  If you look at them by alphabetical order they are being fired as follows; a, b, b, d, e, f producing the log shown. Even if you re-arranged the IBActions or link them differently the same log is produced.

                  这个问题的简单答案是在你的方法名称之前添加字母,例如 aOne, bTwo, cThree 然后它们将按顺序调用,而如果你留下它们 One, 二, 三 由于这个字母顺序,它们将被称为一,三,二.

                  The simple answer to this problem is to add letters before your method names such as aOne, bTwo, cThree and then they will be called in that order, whereas if you left them One, Two, Three they would be called as one, three, two due to this alphabetical order.

                  希望这对人们有所帮助.它让我难过的时间最长.

                  Hope this helps people. It had me stumped for the longest time.

                  这篇关于当从同一个组件调用时,两个 IBAction 触发的顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:快速使用带有多个组件的 UIPickerView 下一篇:E/AndroidRuntime(3306): java.lang.RuntimeException: 无法启动活动 C

                  相关文章

                • <small id='VlyKd'></small><noframes id='VlyKd'>

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

                      <bdo id='VlyKd'></bdo><ul id='VlyKd'></ul>